Help with error

napjones

New member
Local time
Today, 03:13
Joined
Oct 5, 2005
Messages
7
I keep getting this error
"Syntax error (missing operator) in query expression 'WHERE [Section] = Administration AND [Sub_Section] = None;"


DoCmd.OpenForm "Attendance", acNormal, "", "WHERE [Section] = " & strSection & " AND [Sub_Section] = " & strSubsection & ";", acEdit, acNormal


The code is to open up an attendance form based on 2 objects selected from drop down lists. I don't see anything wrong with the code maybe you guys can help. Thanks.
 
leave out the "Where" keyword
DoCmd.OpenForm "Attendance", acNormal, "", "[Section] = " & strSection & " AND [Sub_Section] = " & strSubsection & ";", acEdit, acNormal


Peter
 
I would also include the single quotes around the value:

DoCmd.OpenForm "Attendance", acNormal, "", "[Section] = '" & strSection & "' AND [Sub_Section] = '" & strSubsection & "';", acEdit, acNormal
 
I took out the where, but it seems to still be giving me problems with the "AND"

It works, if I take out the second parameter.
 
did you try Modests version with added quotes?

Peter
 

Users who are viewing this thread

Back
Top Bottom