Access ver 2.0 - Locking/unlocking form with command button

M

Michael

Hi Everyone,

I have a database in access 2.0 in which once payment has been made I
would like to lock or not allow edits on the main form. I would really
like this to be a command button on the main form and if possible when
people try to unlock the form to edit they have to enter a 4digit
password.


I have found some code in the groups that look like they will do the
job but they are all for Access 97 and above and I have big compile
issues when I try to use them.


Thank you!
 
A

Allen Browne

This should work in Access 2:
If Me.Dirty Then Me.Dirty = False
Me.AllowEdits = Not Me.AllowEdits

You will need to extend that code to handle your password requirements, and
naturally it needs error handling in case the save fails.
 
D

David W. Fenton

This should work in Access 2:
If Me.Dirty Then Me.Dirty = False
Me.AllowEdits = Not Me.AllowEdits

You will need to extend that code to handle your password
requirements, and naturally it needs error handling in case the
save fails.

Er, Me.Dirty was read-only until A97 (maybe A95 -- didn't use it
long enough to know). You can use it to find out if a record has
been edited, but you can't set it to False to save the record in
Access 2.
 
A

Allen Browne

Darn, I had forgotten that, David, but you are right.

So , the code would be to test the form's Dirty property, and DoMenuItem to
force the save of the record.
 
M

Michael

Thanks for you help guys,

i have gone with a macro that sets the value of lock to yes when i
press a toggle on the form, its not the best way but its working for
now.
 
Top