Syntax Error (Missing Operator) In Query Expression

lhooker

Registered User.
Local time
Today, 11:00
Joined
Dec 30, 2005
Messages
431
Why am I receiving 'Syntax error (missing operator) in query expression' error message ? Below is the code. Thanks ! ! !

stFrmName = "Previous Plan"
stLinkCriteria = "(Employee = " & strPreviousTeacher & ") And (Record_Date = " & strPreviousDate & ")"
DoCmd.OpenForm stFrmName, , , stLinkCriteria
 
Couple of issues here. The strPreviousTeacher needs to be within double quotes. Either double up your quoates or use CHR(34) to add them. Second, if Record_Date is a date then the date needs to be seperated with a # either side. Depending on where you are from you may also need to form the date to that it is MM/DD/YYYY. Put a break point on the OpenForm and then DEBUG.Print the stLinkCriteria into your intermediate window. You will spot the errors.
 
MLuckham,

I took a different approach. Thanks for your post ! ! !
 

Users who are viewing this thread

Back
Top Bottom