VBKid04
04-14-2004, 06:56 PM
I have a SQL query that is using the DateDiff function, but the system does not like it...
Here is how I am using it:
Set newTaskRS = New ADODB.Recordset
newTaskRS.Open "Select * FROM Query WHERE UserID='" & txtUserID & "'
OR AdminID='" & txtAdminID & "' AND DateDiff('d', ProblemDate, Now) <" &
Val(txtUserInputDate.Text), db, adOpenStatic, adLockOptimistic
But the system keeps throwing up the error:
Run time error -2147217900 (80040e14)
Syntax error (missing operator) in query expression.
Can anyone please help correct it?
Thanks
NOTE: There are no line breaks like my above code, I have just done that to make it easier to read here
Here is how I am using it:
Set newTaskRS = New ADODB.Recordset
newTaskRS.Open "Select * FROM Query WHERE UserID='" & txtUserID & "'
OR AdminID='" & txtAdminID & "' AND DateDiff('d', ProblemDate, Now) <" &
Val(txtUserInputDate.Text), db, adOpenStatic, adLockOptimistic
But the system keeps throwing up the error:
Run time error -2147217900 (80040e14)
Syntax error (missing operator) in query expression.
Can anyone please help correct it?
Thanks
NOTE: There are no line breaks like my above code, I have just done that to make it easier to read here