Using Data from Table in Query

Posted on 2012-08-29
Last Modified: 2012-08-29
I have a query in which I have criteria:  >10 and <=20
I have a table:

Code          Low          High
A                  0               10
B                 10              20

How can I pull the value from the table in column "Low" where Code=A into a query?

FYI:  I have a whole alphabet full of codes and 5 columns of variables that I need to pass to different places in a query.
Question by:dgran
    LVL 119

    Accepted Solution

    try using DlookUp()


    Open in new window

    LVL 61

    Expert Comment

    Try this - Im guessing at your low/high criteria, but you would simply add criteria for code = A like this:

    SELECT Low
    FROM YourTable
    WHERE Code = "A" AND  (Low BETWEEN 10 AND 20) AND (High BETWEEN 10 AND 20)

    Open in new window

    LVL 30

    Expert Comment

    Code          Low          High
    A                  0               10
    B                 10              20

    Look at record With Code=A and return the value under Low?
    This will use DLOOKUP so the value can be used in calculation, or display in a field on a form.

    Look at record With Code=A and return a record with all the values under other columns.
    This uses select With Code =A and criteria so can be displayed in a Form.

    In criteria Low >10 AND AND LOW <=20 ...

    Author Closing Comment

    Thank you!  This worked perfectly.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now