View Full Version : Help with error


napjones
10-05-2005, 08:50 AM
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.

Bat17
10-05-2005, 09:18 AM
leave out the "Where" keyword
DoCmd.OpenForm "Attendance", acNormal, "", "[Section] = " & strSection & " AND [Sub_Section] = " & strSubsection & ";", acEdit, acNormal


Peter

modest
10-05-2005, 12:55 PM
I would also include the single quotes around the value:

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

napjones
10-05-2005, 12:57 PM
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.

Bat17
10-05-2005, 10:10 PM
did you try Modests version with added quotes?

Peter