DLOOKUP question

  • Thread starter Thread starter Rick B
  • Start date Start date
R

Rick B

I have a table called tblLookup with 3 fields similar to the following:

LowRange HighRange Value
1 5 A
6 11 B
12 20 C


In a second table (tblData) I have a field called Amount.

I need the Value from tblLookup based upon the Amount from tblData.
For example, if the value of Amount is 7 in tblData, I want a query that
will return B from tblLookup.
I am able to do it with DLOOKUP on a specific value but I can't figure out
how to find the Value if looking between an upper and lower range.

Any help would be appreciated.

-rick
 
DLookup("Value", "tblLookup", "LowRange <= 7 And HighRange >= 7")

Using a variable, that would be:

DLookup("Value", "tblLookup", "LowRange <= " & lngNumber & " And HighRange
= " & lngNumber)

By the way, I'd advise renaming the field from Value: I believe that's a
reserved word.
 
Back
Top