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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.