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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Between Clause won't work

Status
Not open for further replies.

chuq2001

Programmer
Jul 15, 2002
24
US
In my SQL statement I'm using functions to retrieve parameters for the query, which works until I put a Between clause in, then the query retrieves no records. ANY SUGGESTIONS
 
Couple of suggestions. One, right after you build your Sql statement display it using a messagebox "msgbox(strSql) - where strSql is your sql statement name. Does it display a statement with expected values? Two, are the values that should be 'between' really between? Maybe the values are different than you expect - what if you make a query where the only criteria is the 'between' - does it return the records you want? What if you make a query where the only criteria is that the field value equals what you know is one on the between values you are trying to retrieve - does it return that record? I think this is merely a process of elimination.
 
Depending on how complicated the querry is, I have had trouble in the past using between in the sql statement and have had to resort to using and
Instead of between 1 and 6
>= 1 and <=6
For some reason, that works when I can't get the between to work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top