SQL Statement

IanT

Registered User.
Local time
Today, 21:15
Joined
Nov 30, 2001
Messages
191
Hi

I am using this code but the sql does not seem to work, can anyone help!

Dim strDate As String

strDate = Forms![frmComparison]![cboComparisonDate]

strSQl = "SELECT * FROM qryTest WHERE qryTest.ComparisonDate =" & strDate
 
IanT said:
Hi

I am using this code but the sql does not seem to work, can anyone help!

Dim strDate As String

strDate = Forms![frmComparison]![cboComparisonDate]

strSQl = "SELECT * FROM qryTest WHERE qryTest.ComparisonDate =" & strDate

Assuming cboComparisonDate returns a vsalid date, you need to add a # sysmbol before and after the date value.
Try :
strSQl = "SELECT * FROM qryTest WHERE qryTest.ComparisonDate =#" & strDate& "#"
 
IanT - When you have a problem like this you can use the immediate window to examine your variables and usually find out what going wrong...

Just a suggestion :)
 
And you can also use the Locals window to watch your variables (data and data types of those variables) and objects.
 

Users who are viewing this thread

Back
Top Bottom