VBA sql select statment with date not working

pp8082

Registered User.
Local time
Today, 07:25
Joined
Jan 27, 2013
Messages
29
Hi,

I am trying to select records from a record set based on a date.

When the date, 01/01/2010, is hard coded in the select statement, it works.

rst.LockType = adLockOptimistic
rst.Open "select * from signals where signals.datedaily > #1/1/2010#", CurrentProject.Connection


if i use a variable , it won't execute. What am I doing wrong?

dataentry_fromdate = #1/1/2010#

rst.LockType = adLockOptimistic
rst.Open "select * from signals where signals.datedaily > dataentry_fromdate", CurrentProject.Connection
 
Try;
Code:
rst.LockType = adLockOptimistic
rst.Open "select * from signals where signals.datedaily > [COLOR="Red"]#" &[/COLOR] dataentry_fromdate [COLOR="Red"]& "#" [/COLOR], CurrentProject.Connection
 
Thank Very You
 

Users who are viewing this thread

Back
Top Bottom