Results 1 to 2 of 2
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    No More Than 4 Employees Allowed on Form

    On my form I need to limit the number of employees that can be entered using OnCall as the criteria or use ExpName or Employee ID

    If this criteria is NOT met then disable On Call. In other words if they try and enter a 5th employee then the field On Call/checkbox is disabled
    name of field is OnCall and actual control is named On Call
    I need this to fire on the OnCurrent Event for the form which is named frm_Employees_on_Call_What_Order

    In other words, no more than 4 employees are allowed to be on call at the same time.
    The fields for the query the form is based on are: All are form the Employees table



    Employee ID Employee autonumber primary key
    ExpName name of employee, includes first and last name
    On Call Yes/No checkbox used for if a employee is on call or not

    query used is named qry_On_Call

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    So need to check if 4 employees already on call and disable OnCall checkbox? Try DCount function, something like:

    If DCount("ID", "tablename", "OnCall=True") = 4 Then
    Me.OnCall.Enabled = False
    End If

    Also, want similiar code to disable OnCall when an employee is 4th selected? Not sure what event this could go in.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 04-16-2012, 12:56 PM
  2. Replies: 10
    Last Post: 11-09-2011, 01:56 PM
  3. Not Allowed To Run Delete Query
    By batowl in forum Queries
    Replies: 5
    Last Post: 01-27-2011, 03:43 PM
  4. Two fields not allowed in Report
    By normie in forum Reports
    Replies: 1
    Last Post: 07-10-2010, 04:40 PM
  5. Total Number of Fields allowed on a Form
    By tpearo in forum Forms
    Replies: 1
    Last Post: 12-15-2005, 06:57 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