Results 1 to 5 of 5
  1. #1
    00253's Avatar
    00253 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2017
    Posts
    5

    Beginner - How to look up & display referential data based on 2+ parameters in a form?

    Hello to whoever is reading this,



    I don't have any experience with databases but I've picked up Access to create a statistic process control in my workplace. I can't figure out how to "build" the database with the functionality I seek. I just need someone to send me in a direction and then I'll self-learn; I just don't want to go through hundreds of pages of tutorials to find a solution. I'm self-taught in Excel + VBA and I can get around most of the problems when I need to (using VBA), but I want to know how to design this 'the right way'.

    I'll use a flower example to ilustrate my case. This is the main table, "tabFlowers":
    ID Flower Color Price
    1 ROSE RED 2.60
    2 ROSE YELLOW 2.20
    3 TULIP RED 1.90

    In my form "formLookup", I want to be able to select Flower and Color from two separate drop down lists, each with non-duplicate values. Then I want to autofill a textbox with the corresponding price (to 'look up' the price based on flower and color). What is the correct way to build the form and related components? Could this be achieved "live", just as Flower or Color are selected in the form?

    I know this is a very broad question, but I've tried several times on my own and none of my solutions worked well. I wanted to used "DLookup" but I think it only allows to lookup based on a single parameter. I'll be using several parameters in my actual database.

    Thank you for your time.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If you wanted to use DLookup(), you can certainly use multiple parameters. See the multi-parameter example at the bottom:

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

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I should add, depending on what the actual situation is, I might use a recordset instead. It depends on your specifics and what you're comfortable with.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    00253's Avatar
    00253 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2017
    Posts
    5
    Thanks, pbaldy, I don't know why I never bothered looking if DLookup() can actually use multiple parameters. Seems like I'll be able to move on now. Thanks again!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem, post back if you get stuck.
    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: 4
    Last Post: 11-02-2015, 02:23 PM
  2. Replies: 6
    Last Post: 04-04-2015, 08:10 AM
  3. Replies: 3
    Last Post: 03-27-2014, 05:05 PM
  4. Replies: 19
    Last Post: 12-11-2012, 05:51 PM
  5. Replies: 2
    Last Post: 06-17-2010, 04:15 PM

Tags for this Thread

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