Results 1 to 3 of 3
  1. #1
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,065

    2 combo boxes on a form 1 dependent on the other to retrieve data from a table.

    I have the following issue.

    Advertisements Database
    Adv_ID
    Advertisement


    used to track All of our Ad sources: Newspaper, Radio, Facebook ...

    Customer Database
    CustomerID
    Demographic data...

    used to track our customers

    Adv_DateID Primary Key
    Adv_ID Foreign Key to Advertisements
    Adv_Date

    To Store the date of that type of Advertisement Since the advertisements could be published multiple times


    Finally a linking Table to put all of the data together
    CustomerID
    Adv_ID
    ADV_DateID

    the linking table is used as the source for a subform. The main form is the customer and the 2 forms are linked by the customerid. The subform has 2 combo boxes one that uses the Adv_id to pull the Advertisement that produced the call by the customer and one that uses the Adv_DateID to pull when that advertisement was run.

    The problem is that the data for the Adv_Date combo box is dependent on the data for the Advertisement combo box and I can't seem to get it to work.

    the SQL for the second combo box uses the first combo box as the criteria. "Select Adv_Date from tbl_Adv_dates where Adv_DateID = Combo0"

    I've tried putting brackets around the Combo0 tried the full path Forms!frm_Adv_date!combo0 Tried me.combo0 Nothing works. Any help is appreciated.

    A linking table to associate the customer with the advertisement that produced the call

    CustomerID Foreign Key


    Adv_ID Foreign Key
    AdvDate Date the Ad Ran


    There is also a table to track the Advertisement Date since 1 Advertisement type Newspaper etc could be used multiple times and multiple customers could call in on them

    Adv_ID
    Customer_ID

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You CAN rename your combos so they are readily identifiable , like cboClients.
    so in the cboClients_afterupdate event
    you need to refresh the cboAdsFor1Client box.
    cboAdsFor1Client.requery

    This will allow it to read the new setting.
    as for the query SQL, you must put the FULL path name of the combo
    Be sure to use a query in the rowsource, (not sql)

    Select Adv_Date from tbl_Adv_dates where Adv_DateID =" & Forms!frm_Adv_date!combo

    (it works, I use it all the time.)

  3. #3
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,065
    The actual names of the combo boxes are in my actual query I posted using generic names to make it easier to type and read.

    I thought I'd figured out my mistake The combo box I was referring to is on a subform and I wasn't including the main form

    original:

    forms!subformname!combo0

    revised

    forms!mainformname!subformname!combo0

    unfortunately that didn't work either. Still prompts for data.

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

Similar Threads

  1. dependent combo boxes
    By jle0003 in forum Forms
    Replies: 3
    Last Post: 10-03-2012, 02:23 PM
  2. Multiple dependent combo boxes
    By anunat in forum Forms
    Replies: 15
    Last Post: 07-09-2012, 03:09 PM
  3. Replies: 1
    Last Post: 03-09-2012, 07:43 PM
  4. Dependent Combo Boxes
    By schwabe in forum Forms
    Replies: 3
    Last Post: 01-09-2012, 04:33 PM
  5. Combo Boxes with dependent queries
    By K Roger in forum Access
    Replies: 3
    Last Post: 09-27-2011, 11:58 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