Field lock after entering data

mdg

Registered User.
Local time
Today, 03:41
Joined
Feb 17, 2011
Messages
68
I have a form that I need to lock the field (text box) after I enter the data (and unlock it if I need to update the data). I don't want to lock the entire record since other data in the form is changed periodically. It would be nice if it could lock during a save function. Any ideas?
Thanks
 
You can do this by simply modifying the Locked proerty of the text box with;

Me!YourTextBox.Locked = True
Me!YourTextBox.Locked = False

You could lock it in, for example, the After Update event of the text box itself as long as you have a simple method, like a command button or something, to unlock it again for edits. Also, you would probably want to make sure it is unlocked for new records using the Current event of your form;

Code:
Private Sub Form_Current()
 
    If Me.NewRecord Then Me!YourTextBox.Locked = False
 
End Sub
 

Users who are viewing this thread

Back
Top Bottom