|
-
Oct 7th, 1999, 04:52 PM
#1
Thread Starter
New Member
Hello
My problem lies with accessing data by using the Where clause on a SQL statement when opening a Recordset.
I can pass the date restriction fine when I enter the date directly I.E.
adoPrimaryRS.Open
"select Date,Time,Traff,Outgoing,Incoming
from InOut
where Date = ' 99-09-09 '", db, adOpenStatic, adLockOptimistic
However I want the user to select a date, which is passed to a variable (this passes OK to a Label for example). I am receiving an empty recordset with the following;
adoPrimaryRS.Open "select Date,Time,Traff,Outgoing,Incoming
from InOut where Date = ' " & strTest & " '", db, adOpenStatic, adLockOptimistic
Where am I going wrong??
Any help Greatly appreciated
Chris
-
Oct 7th, 1999, 05:49 PM
#2
New Member
I haven't tried ti with ado, but have done with RDO. Sometimes enclosing the where condition alone in paranthesis helps. Also, I think you may have to leave a space in between the last two quotes like
adoPrimaryRS.Open "select Date,Time,Traff,Outgoing,Incoming
from InOut
where (Date = ' " & strTest & " ')", db, adOpenStatic, adLockOptimistic
If you're doing this from outside the USA then maybe you have to send the variable value as ' " & datevalue(strTest) & " '.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|