Locking Form on Open

forms_are_nightmares

Registered User.
Local time
Today, 01:03
Joined
Apr 5, 2010
Messages
71
Hope this is easy and I'm just overlooking the obvious.

Scenario:

I have one form that two groups of users use. One group edits the form; the other won't. Rather than writing code to disable all the controls, boxes...etc. on the form, I was hoping there was a way to "lock" the form when it's opened.

Setup:
Two buttons on different forms direct the users to the above form. How can I code the one button to lock the form?

Any help is always appreciated.
 
would this lock the form and all of its records. What if only certain records are locked; could a On_Current work???
 
would this lock the form and all of its records. What if only certain records are locked; could a On_Current work???
If you put Pat's code in the On Current event of the form, then each record will be locked/unlocked, depending on the value of the expression used in the If/Then statement.
 
the only thing is, that locking all the controls also locks things like unbound comboboxes which you may use for other reasons.

because of this, sometimes it is better to lock selected controls in code, rather than the whole form

note that even if the form is locked for edits, a command button, (vba code) can still be used to change data.


a different approach might even be to have two forms - one for each class of users, which b
puts the coding problem into a different area (ie your switchboard) - but gives you the flexibility of designing the form completely differently in each case.
 

Users who are viewing this thread

Back
Top Bottom