Results 1 to 5 of 5
  1. #1
    craiggodbold is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Posts
    2

    Lookup ID after selecting multiple combo boxes


    Hi guys I'm need of some serious help here.
    I have 3 drop down boxes where you can select the type of Sponge, Topping and Filling for the cakes. The 3 drop down boxes link to individual tables (toppings, fillings and sponges) In another table I have combinations of the toppings and an ID key for each combination.

    When a particular combination is chosen from the drop downs is there a way to search for that particular combination and display the ID key in another text box from the combination table

    Hope that makes sense

    Thank you

    Craig

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can use a DLookup() or recordset. You can create a query that uses the 3 combos in the criteria, which would guide you to the SQL for the recordset or the criteria of the DLookup:

    DLookup Usage Samples
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    craiggodbold is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Posts
    2
    Thanks very much for the reply. Very helpful. I was working with the lookup earlier but can get ahead around this problem. I have the set field name and the table name to go to where those combinations are but am lost as to what I put in the criteria.

    Im my head it says looks at the contents of drop down menu 1,2,and 3 and then go to the query and find out what the id of that combination is. Easy in my head I just not have an idea on how on earth to get a text box to return that ID value

    Text47 = DLookup("CakeID", "Cake Query", "Criteria =?'")

    Thank you so much

    **Sorry I meant to add before I posted it is the Criteria the 3 dropdown boxes that would create the combination (hopefully that makes sense)

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    PMFJI,

    Using the link provided by Paul, you would use the bottom example.

    Need to know the combo box names and the value type: number or text.

    Using the combo boxes names of cboToppings, cboFillings and cboSponges,
    if the combo box values are text in the table "Cake Query", the DLookup would be
    Code:
    Text47 = DLookup("CakeID", "Cake Query", "[toppings] = '" & Me.cboToppings &"' AND [fillings] = '" & Me.cboFillings & "' AND [sponges]= '" & Me.cboSponges & "'")

    If the values are numbers, (no delimiters)
    Code:
    Text47 = DLookup("CakeID", "Cake Query", "[toppings] = " & Me.cboToppings &" AND [fillings] = " & Me.cboFillings & " AND [sponges]= " & Me.cbosponges )

    Note: shouldn't use SPACES in any object names....... "CakeQuery" would be a better table name.

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'll get out of the way.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 09-22-2016, 08:42 AM
  2. Using Multiple Combo Boxes
    By adamjon92 in forum Forms
    Replies: 1
    Last Post: 02-05-2016, 03:55 PM
  3. Selecting multiple elements from a lookup table
    By JRohde in forum SharePoint
    Replies: 1
    Last Post: 11-10-2015, 12:21 PM
  4. Selecting records based on 2 combo boxes
    By comteck in forum Database Design
    Replies: 1
    Last Post: 07-10-2012, 06:05 PM
  5. Lookup multiple columns in combo box
    By fcp in forum Programming
    Replies: 1
    Last Post: 12-22-2011, 08:44 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