Results 1 to 3 of 3
  1. #1
    ExtremeNovice is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2017
    Posts
    24

    Help: combo box list needs to be dependent on what is entered in another combo box on same form.

    I have two combo boxes on my form.



    The first box selects an Employee and is bound to the EmployeeID from the table: tblEmployee.
    The second combo box selects the employee's pay rate and is bound to the PayID which is on a related table: tblPay.
    (Employees can have a variety of different pay rates depending on the job they are performing.)

    I need a SQL statement for the row source of the PayID combo box that will only display the PayRate(s) for the EmployeeID that is selected in the first Combo box.

    My Current PayID combo box row source SQL statement returns all pay rates for all employees:

    SELECT tblPay.PayID, tblPay.EmployeeID, tblPay.PayRate FROM tblPay;

    I am hoping that it is as easy as adding a WHERE condition but I have tried several different approaches and haven't had any success.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    change your payid rowsource to

    SELECT tblPay.PayID, tblPay.EmployeeID, tblPay.PayRate FROM tblPay WHERE tblPay.EmployeeID=[cboEmployee]

    where cboEmployee is the name of the employee combo

    then, in the employee combo after update event put

    cboPayID.requery

  3. #3
    ExtremeNovice is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2017
    Posts
    24
    Awesome - Thank you!

    To the other novice's who read this: I couldnt just type "PayID.requery" into the employee combobox after update event, I had to build a requery macro and set the PayID as the control name.

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

Similar Threads

  1. Dependent Combo Box and Form Generation
    By Khermann in forum Forms
    Replies: 11
    Last Post: 08-19-2016, 01:57 PM
  2. Replies: 1
    Last Post: 04-05-2016, 09:25 AM
  3. Replies: 3
    Last Post: 01-29-2016, 08:52 PM
  4. Replies: 2
    Last Post: 05-29-2015, 09:21 AM
  5. Replies: 3
    Last Post: 02-26-2009, 10:17 AM

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