I have been going crazy slowly all week. When I step through my code I
get Run Time Error 3075, Syntax error, Missing Operator in Query
Expression. I think that I have narrowed the error down to the next to
last line of the following code, where the function MonthNumber is
used. The fields that start with 'Choose' are fields on a form.
StudentIDData is a variant. Can anybody help???? Please
StrSQL = " SELECT tblStudentMaster.[Last Name] AS LastName,
tblStudentMaster.[First name] AS FirstName, tblStudentMaster.StudentID,
tblStudentMaster.status, tblStudentMaster.Month,
tblStudentMaster.[Start Date] AS StartDate, tblStudentMaster.YearX,
tblStudentMaster.Month, MonthNumber([Month]) AS MonthNbr, *" _
& " FROM tblStudentMaster" _
& " WHERE (((tblStudentMaster.StudentID) = " & StudentIDData & ")" _
& " And ((tblStudentMaster.Month) = """ & Me![ChooseMonth] & """)" _
& " And ((tblStudentMaster.YearX) = """ & Me![ChooseYear] & """))" _
& " Or (((tblStudentMaster.StudentID) = " & StudentIDData & ")" _
& " And ((tblStudentMaster.YearX) > """ & Me![ChooseYear] & """))" _
& " Or (((tblStudentMaster.StudentID) = " & StudentIDData & ")" _
& " And ((tblStudentMaster.YearX) = """ & Me![ChooseYear] & """)" _
& " And ((MonthNumber(tblStudentMaster.[Month])) > " & "MonthNumber("""
& Me![ChooseMonth] & """)))" _
& " ORDER BY tblStudentMaster.YearX, MonthNumber([Month]);"