Results 1 to 3 of 3
  1. #1
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038

    Enable/disable control

    Hello Experts:

    I need a general recommendation for enabling/disabling a control on a form based a query (where the query is NOT the form's row source). Below are more details (general concept):

    - Let's say I have a table with 1,000 employees


    - On a single form, I have a number of fields (last name, first name, address, etc. etc.)
    - Now, out of the 1,000 employees, only a subset of individuals may be considered "leadership". So, let's say only 50 out of the 1,000 employees are considered "leadership".
    - Now, all of these 50 employees must complete "leadership training". As of now, however, let's say only 30 completed this training. The other 20 have not.
    - A query (including the employee number) reference which 50 employees are part of leadership.

    What I need to achieve on my form:
    - Now, my form uses a different query as the row source. This query includes the 1,000 employees.
    - On my form, I have a field/combo box "Leadership Training Status". The values in this field are either "Completed Training" or "Not Completed Training".
    - Now, I only want the combo box (training status) be active for those 50 employees who are considered leadership.
    - All of the other 950 employees will show the field but it needs to be disabled. That is, I do NOT want to accidentally change the value to "Completed Training" for any employee NOT part of the 50 leaders.

    In summary, how can I enable/disable the combo box based on the employee ID? Again, I may be on record where employee ID = 273. If employee ID 273 is NOT part of query which identities the 50 leaders (not form's row source), I then want to disable the combo box. If current employee record is also part of the leadership query, I want to enable the combo.

    I hope this makes sense.

    Cheers,
    EEH

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You have a table of users who log in to your db and that table identifies their profile/level/status - whatever you want to call it?
    If it's not part of the form query, why not? I suspect it's because you don't have that table, or at least have not thought to link it to the form recordsource. If the combo is part of that recordsource and you have this table with the required info then it should be easy enough to join that table. Then when the form loads you retrieve the level info and in code, disable the control if it doesn't pass the test.

    BTW, forms don't have row sources - they have record sources.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Like:
    CboBox.enabled = chkBoxLeadership.value

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

Similar Threads

  1. Enable disable function not working
    By jj1 in forum Access
    Replies: 5
    Last Post: 02-26-2015, 12:09 PM
  2. Replies: 2
    Last Post: 11-30-2012, 08:03 PM
  3. Enable/Disable Button
    By P.Malius in forum Programming
    Replies: 3
    Last Post: 09-07-2012, 08:36 AM
  4. Enable or Disable Field in Forum
    By lolos66666 in forum Forms
    Replies: 5
    Last Post: 03-13-2011, 05:30 PM
  5. Function to Enable/Disable Field
    By swalsh84 in forum Programming
    Replies: 5
    Last Post: 11-04-2010, 02:48 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