Hi all,
On a form I have some fields that I want to lock with a check box. If the data has to be changed then the check box can be unmarked.
How would I do this.
Sorry, Aceman, I don't understand your quote. When, exactly, is a control in "edit mode?" This code should do what the OP wants, unless I've misinterpreted his post.
Code:
Private Sub Form_Current()
If MyCheckBox Then
Me.MyTextBox.Locked = True
Else
Me.MyTextBox.Locked = False
End If
End Sub
Code:
Private Sub MyCheckBox_AfterUpdate()
If MyCheckBox Then
Me.MyTextBox.Locked = True
Else
Me.MyTextBox.Locked = False
End If
End Sub
Thanks The Missinglinq,
Thats what I needed. Sorry The Aceman1. What I wanted was to be able to lock a field once data has been entered to stop idiot staff from removing it...
I tried the code and it works great.
When you enter the 1st character! This triggers the [blue]OldValue[/blue] property as well as causing the record to enter edit mode (depicted by the pencil icon) if its the 1st character entered in the record.
kpryan said:
[blue] . . . What I wanted was to be able to lock a field once data has been entered to stop idiot staff from removing it...[/blue]
I wasn't sure if you intended to lock fields while editing! I did say it was something to consider! However your locking after data entry, which is fine.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.