View Full Version : need help with sql statement for a range


itmasterw
07-11-2007, 04:26 AM
Hi, I have atable with ID ranges like this:
ID1 ID2 Logo
1 50 HO
51 75 HY
76 100 GM

I want to know how I would write a SQL statement that would find which logao given a certain input. So for example, If I had th euser enter 53 from a textbox on a form it should bring back HO. Can someone please help me with this.
This is the kind of thing that I tryed so far, but does not work:

SELECT Logo
FROM tblLogo
Where forms!frmTest!Text0 Between(ID1) (ID2);

Jon K
07-11-2007, 07:40 AM
Assuming ID1 and ID2 are numeric fields i.e. not text fields,

SELECT Logo
FROM tblLogo
Where forms!frmTest!Text0 Between [ID1] And [ID2]

.

itmasterw
07-11-2007, 08:17 AM
That did it, I see the I missed the AND, thought I thought that I had put it in.
Thank You