Disable edit in text box

John Steven

Registered User.
Local time
Today, 14:31
Joined
Jun 24, 2002
Messages
10
I would like to disable editing in a text box once the information has been entered initially, but would like to be able to turn editing back on by double clicking the text box label. This is to be used for a database I'm creating for truck fleet management. Any ideas??
 
Editing

There are several ways to do this. First, set the text box (let's call it text0) as me.text0.enabled=false in the properties setting of the text box. If you want them to be able to edit it by double clicking on the text box text0 simply put in the Double Click property me.text0.enabled=true. Also, in the After Update field use me.text0.enabled=false.

If you truly want them to have to double click on a label then simply place another unbound text box on the form with your caption in the data property of the text box such as data: ="My label". Set the locked property to yes and under format use the flat format instead of sunken. In other words, make it look like a label. Then, in the double click property set it to me.text0.enabled=true.

Hope this helps
 
Thanks for the fast reply Rickster57. I tried the method with the text box formatted as a label and it worked fine. I would like when the text box loses focus, for it to be disabled. My adaptations of the code only trigger the debugger with a warning that a control cannot be disabled while it has focus. Any thoughts??
 
Lost focus

In the Lost Focus event set the focus to a different text box, or command button on the form. Then code in me.textboxofinterest.enabled=false. So basically move the focus to a different control and then you can disable the text box for editing.

Good luck.
 
Thanks for the help Rickster. It works perfectly. Hope I can return the favor sometime.
 

Users who are viewing this thread

Back
Top Bottom