MS Access Form lock control

Posted on 2012-08-22
Medium Priority
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

Accepted Solution

jjnet123 earned 2000 total points
ID: 38321067
In the "OnCurrent" property of the form, add the following VBA code:

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

Expert Comment

by:Jim Horn
ID: 38321081
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

ID: 38321187

Watch for followup

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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