Results 1 to 4 of 4
  1. #1
    dek is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2011
    Posts
    4

    Form : Lock all controls in form

    Hi,

    I have a field named 'Locked' (which is a check box) in my form that is bound to the master table.

    The checkbox stores TRUE or FALSE in the table.

    I would like to lock all control properties in the form and subform (except for the 'Locked' control) automatically when selecting the LOCKED control and on leaving the record.

    A simple VBA solution using the event 'after update' would be appreciated.

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Only way I know is to address each control and set its Locked property. Like:
    Me.controlname.Locked = Me.[Locked]

    Place all these lines in a Sub that can be called from the AfterUpdate and the OnCurrent events.

  3. #3
    vt800c is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    23
    Since the LOCKED control would be either True or False, why not set the default 'Locked' property on each control to me.[locked]? (or forms!formname.locked, whichever is correct...)

  4. #4
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    I think vt is partially right....but I believe the solution will involve looping through each control on the form after update and on current. Here's a link that gives a pretty good example: http://access.mvps.org/access/forms/frm0004.htm

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-23-2011, 09:01 PM
  2. Replies: 5
    Last Post: 06-29-2010, 06:10 AM
  3. form controls & recordset
    By slow&steady in forum Forms
    Replies: 2
    Last Post: 06-25-2010, 02:49 PM
  4. Can I lock out fields in a form by keying off...
    By swampdonkey in forum Access
    Replies: 2
    Last Post: 09-07-2006, 07:16 AM
  5. Adding Controls to a Form
    By msmayhew in forum Programming
    Replies: 7
    Last Post: 12-14-2005, 03:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums