Lock/Unlock by clicking a button

aaronmib

Registered User.
Local time
Today, 15:53
Joined
Oct 13, 2011
Messages
14
I would like to keep a field on a Microsoft Access form locked until I click a button on the form, how do I do that?
The Button name is NewNote and the field I want to unlock when clicking the button is VendorID.

Any Suggestions? Thanks
 
Last edited:
On the Form's Load event code the control to be locked.

Me.controlname.Locked = True

In the pushbutton click event, unlock the same control

Me.controlname.Locked = False

** Oops, Load comes after Open, best try Load first then, to make sure the GUI is ready to be manipulated.
 
Locking the field works perfectly. The button I want to push to activate the field also creates a new record in the database. When I try to add Code to the Button, it opens in the Macro builder. Is there a way to have the button create a new record and unlock the field? I cannot figure out how to do both.
 
When I try to add Code to the Button, it opens in the Macro builder..

That is very odd. Do all of your buttons work this way, or just this one?

In the Properties Sheet \ Event tab select the On Click event of the Button. There should be a drop down list with "[Event Procedure]" in the list. Pick that one, then click the [...] button next to it and the VBA editor screen should open with the sub of the event coded for you.

If not, perhaps something is wrong with thus button instance. Consider building a new / replacement button.
 
I was hitting the ... without changing to the "[Event Procedure]" thanks
 

Users who are viewing this thread

Back
Top Bottom