E
esjadee
Guest
I have a very simple database for which I was given some code to lock the fields in a form which have data in to stop users inadvertently or deliberately overwriting or amending existing data.
The only problem is the code also disables the command buttons I placed on the form to search, add a new record & close the application. Now the last two I can manage without but the search button is vital to enable users to check the records before adding new records.
I was going to attach the database so anyone who might be able to help could play with it but I'm not sure how to do it as .mdb file extensions are not valid apparently!
Anyway the code I was given is:
Private Sub Form_Current()
On Error Resume Next
Dim ctl As Control
Dim boo As Boolean
For Each ctl In Me
boo = IsNull(ctl)
ctl.Locked = Not boo
ctl.Enabled = boo
Next
Set ctl = Nothing
End Sub
I would really appreciate some help my original query can be found under http://www.access-programmers.co.uk/forums/showthread.php?t=77009&highlight=lock+data+forms
Cheers guys.
The only problem is the code also disables the command buttons I placed on the form to search, add a new record & close the application. Now the last two I can manage without but the search button is vital to enable users to check the records before adding new records.
I was going to attach the database so anyone who might be able to help could play with it but I'm not sure how to do it as .mdb file extensions are not valid apparently!
Anyway the code I was given is:
Private Sub Form_Current()
On Error Resume Next
Dim ctl As Control
Dim boo As Boolean
For Each ctl In Me
boo = IsNull(ctl)
ctl.Locked = Not boo
ctl.Enabled = boo
Next
Set ctl = Nothing
End Sub
I would really appreciate some help my original query can be found under http://www.access-programmers.co.uk/forums/showthread.php?t=77009&highlight=lock+data+forms
Cheers guys.