By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,598 Members | 1,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,598 IT Pros & Developers. It's quick & easy.

Creating a checkbox to lock/unlock an entire form and subform

P: 1
I have created a database that will be used among many users. In order to protect the data, I am trying to create a checkbox that can either lock or unlock the forn and subform for editing. It would also be useful if the background color of the fields changed color when locked. I have created the database in design mode and am not very familiar with VBA. Any insight would be greatly appreciated. Thanks!
Jun 26 '09 #1
Share this Question
Share on Google+
1 Reply

P: 36
I'm not sure if the instructions will make sense but.
for the checks box use after_update event and change for instance this property me.Form.AllowEdits = False
Regarding changing the background you have to add a loop into the code
something like that
dim ctr as control
for each ctr in me.Form.Controls

if left(,3) = "txt" then 'assuming all your text boxes start with txt
ctr.backcolor = vbred
end if


'you can also check background for all text boxes regardless of name using
ctr.ControlType = acTextBox

Remember that in the after update event you need 2 kinds of code so you need
if checkbox = true then


end if

I hope it helps
Jul 1 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.