MS Access Form lock control

Posted on 2012-08-22
Last Modified: 2012-08-22
[I have a form (I inherited) with about a kajilion databound controls on it

There is a Check Box that I need to lock based on the value of a different datafield in my record source.


chkSuggestJunk needs to be locked when datafield  [Submit Stage] = 'Reject Submit'

This is the image of the checkbox properties

Question by:lrbrister
    LVL 1

    Accepted Solution

    In the "OnCurrent" property of the form, add the following VBA code:

    If Me.[Submit Stage] = "Reject Submit" Then Me.chkSuggestJunk.Enabled = False
    LVL 65

    Expert Comment

    by:Jim Horn
    The code for this is simple...

    If Me![Sumbit Range] = "Reject Submit" then
       Me.chkSuggestJunk.Locked = True
       Me.chkSuggestJunk.Locked = False
    End If

    The trick is .. how many places will you need to execute it?  Examples are ... Form.Open, Form.BeforeInsert, [Submit Change].AfterUpdate, etc.

    Author Closing Comment


    Watch for followup

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    This article will show you how to use shortcut menus in the Access run-time environment.
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now