Lock bound fields in form On Load

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BarbieJo
    New Member
    • Jun 2010
    • 1

    Lock bound fields in form On Load

    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:

    =LockBoundContr ols([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!
  • jimatqsi
    Moderator Top Contributor
    • Oct 2006
    • 1293

    #2
    I searched the web and found the routine
    LockBoundContro ls, 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 LockBoundContro ls(...) you might simply put there
    Code:
    me!control1.locked = true
    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

    Comment

    Working...