DLOOKUP question

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
 
D

Douglas J. Steele

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top