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

Lock bound fields in form On Load

P: 1
Using Access 2007

I want all the bound fields in my form to be locked until a command button is clicked. I have already tried locking the form through the OnLoad property using the following code:

=LockBoundControls([Form],True)

This approach is not working, unless I am doing something wrong. I am entering this code into the expression builder.

I would prefer to use the module builder if anyone has suggestions for code. I am new to Access and any help is greatly appreciated!
Jun 22 '10 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,221
I searched the web and found the routine
LockBoundControls, it looks like a custom function Allen Brown wrote, not something built in to VBA. Is that right? Have you put his entire code into your routine?

If not, you might have error trapping set that just skips on past an error calling a function that does not exist in your program. You might want to google that function and copy and paste it into your program.

Or, you might simply write your own few lines of code that are less general and specific to your particular form. Instead of using LockBoundControls(...) you might simply put there
Expand|Select|Wrap|Line Numbers
  1. me!control1.locked = true
  2. me!control2.locked = true
... repeat for all your controls, using your control anmes

and then when appropriate set the .locked=false for the controls.

Hope this helps,
Jim
Jun 23 '10 #2

Post your reply

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