By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,011 Members | 2,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,011 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
Hi
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(ctr.name,3) = "txt" then 'assuming all your text boxes start with txt
prefix
ctr.backcolor = vbred
end if


Next

'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

else

end if

I hope it helps
Emil
Jul 1 '09 #2

Post your reply

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