Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign value based on field between diff values 1

Status
Not open for further replies.

DajTwo

Technical User
Jul 17, 2008
157
US
I know how to do this with a series of Iif statements but I would like to do this where I can change the 'borders' in a table

Depending on the value of a $ field [$field], I want to assign an [id] depending if [$field] is between 0 to 101, 100 to 200, 201 to 300 etc..

The reference table would look like [id], [lowerborder], [highborder].

How can I put the border in a table instead of in the IIf statement?

Thanks
 
A starting point (SQL code):
SELECT *
FROM yourTable INNER JOIN tblBorder
ON yourTable.[$field] BETWEEN tblBorder.lowerborder AND tblBorder.highborder

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the tip. I appreciate!!
 
BTW IS there a way to do the same in VBA?
 
You may use the DLookUp function against a query, or use a Recordset.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks again for the line of direction.. Ill play around and come back if Im stuck :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top