ans303
Technical User
- Jan 24, 2009
- 5
I want to lock a specific field on a new record using Access 2003. The name of the field is DO Staff. DO Staff is a combo box. I want to lock DO Staff on a new record so it cannot be changed after it is saved. What is happening is after I do this one time DO Staff is locked for all subsequent records. I want the ability to select DO staff on each new record, then save and lock it as to that record only, and so on.
I am trying to accomplish this by using the following:
Private Sub DO_Staff_AfterUpdate()
If Form.DO_Staff.Locked = False Then
Form.DO_Staff.Locked = True
End If
End Sub
I can see where this locks DO Field.
Then I am using the following to be able to repeat this on each new record, and it is not working:
Private Sub Form_Current()
If Me.NewRecord Or IsNull(Me!DO_Staff.Value) Then
Me.DO_Staff.Locked = False
End If
End Sub
It doesn't like
If Me.NewRecord Or IsNull(Me!DO_Staff.Value) Then
and turns it yellow.
Please make a recommendation how to accomplish this. I appreciate any comments.
Thanks.
I am trying to accomplish this by using the following:
Private Sub DO_Staff_AfterUpdate()
If Form.DO_Staff.Locked = False Then
Form.DO_Staff.Locked = True
End If
End Sub
I can see where this locks DO Field.
Then I am using the following to be able to repeat this on each new record, and it is not working:
Private Sub Form_Current()
If Me.NewRecord Or IsNull(Me!DO_Staff.Value) Then
Me.DO_Staff.Locked = False
End If
End Sub
It doesn't like
If Me.NewRecord Or IsNull(Me!DO_Staff.Value) Then
and turns it yellow.
Please make a recommendation how to accomplish this. I appreciate any comments.
Thanks.