October 21, 200223 yr Can one, through script, program a routine that "disables" an entry into field or checkbox? For example: If a record has a status of "1" (open) checkbox 1 can be checked, if status is "2" (locked) checkbox 1 can not be checked. In VB this would be written: If textboxA.text = "Open" then check1.enabled = "True" else check1.enabled ="False" End if I am trying to allow or not allow field entry depending upon the record status WITHOUT creating additional forms. Any ideas??
October 21, 200223 yr In Field Format there's a checkbox that will allow entry into a field. Uncheck that so that there's no entry into the field. Then create a button the same size as the field and put it under the field. Now when the user clicks on the field, they invoke the script specified by the button. Code that script like this: If [ RecordLocked ] Beep Else Go to Field [ MyField ] End If As a result, when the record is not locked, they end up in the field much like they would expect. They'll never realize they bypassed the field, clicked a button, and the button put them in the field. Instead of the beep, you could even have it throw up a message explaining to them that the field is locked. Well, that's one way... the smart guys may know a better way. HTH.
October 21, 200223 yr Sounds pretty smart to me! I see that I can also use that for other things. Thanks much. I LOVE gleaning information from other people's questions
October 22, 200223 yr If you look in my Handy Bits file (RussCalcs from Oz) in the samples section of this forum, there is an example under the Text Tab of how to do this using field validation by the contents of another "locking" field. This way, when a record or field has been "locked", you cannot edit the contents. You can also expand this concept to locking the field after a certain number of hours since the record was created.
October 22, 200223 yr Author Your handy bit solution appears to be the closest I can get to a background code without an additonal layout. This there a method to change the background color of the locked text box or check box through this method? Thanks for your help
October 23, 200223 yr Yes - if you look at the "Colours" tab of the file, you will see how you can store colours in a repeating global field - and then use these to fill other calculated container fields to provide background colurs depending on other field values. For your situation, create a calculation (container) field to place behind the field you want to lock. Make the field you want to lock transparent. Make the container field not to allow user entry and format it to expand to fill and un-check maintain proportions. Using the field names from the file, the calc would then be: Case(txt_Locked Status = "Yes", GetRepetition(col_g_dv_Colour Backgrounds,2), GetRepetition(col_g_dv_Colour Backgrounds,8))
Create an account or sign in to comment