W
Winger
As I can't write SQL I use the query builder to give me the SQL to define my
RecordSet.
My Query works fine:-
SELECT tblPeople.FirstName, tblPeople.LastName, tblPeople.UCLanEmail,
tblPeople.[IncludeInEmail?], tblPeople.[IncubationClient?],
tblPeople.[Archive?]
FROM tblPeople
WHERE (((tblPeople.UCLanEmail)<>"") AND ((tblPeople.[IncludeInEmail?])=Yes)
AND ((tblPeople.[IncubationClient?])="No") AND ((tblPeople.[Archive?])=No))
ORDER BY tblPeople.LastName;
but when I drop it into my code as follows:-
mySQL = "SELECT tblPeople.FirstName, tblPeople.LastName,
tblPeople.UCLanEmail, tblPeople.[IncludeInEmail?],
tblPeople.[IncubationClient?], tblPeople.[Archive?]"
mySQL = mySQL + "FROM tblPeople "
mySQL = mySQL + "WHERE (((tblPeople.UCLanEmail) <> "") And
((tblPeople.[IncludeInEmail?]) = Yes) And ((tblPeople.[IncubationClient?]) =
False) And ((tblPeople.[Archive?]) = No))"
mySQL = mySQL + "ORDER BY tblPeople.LastName;"
I get a syntax error.
This usually occurs with the brackets of the various "WHERE" clauses but I'm
still not sure on how the Chr$34$ should be used.
All the fields in the WHERE clauses are Yes/No fields.
Any help would be very much appreciated.
thanks
Winger
RecordSet.
My Query works fine:-
SELECT tblPeople.FirstName, tblPeople.LastName, tblPeople.UCLanEmail,
tblPeople.[IncludeInEmail?], tblPeople.[IncubationClient?],
tblPeople.[Archive?]
FROM tblPeople
WHERE (((tblPeople.UCLanEmail)<>"") AND ((tblPeople.[IncludeInEmail?])=Yes)
AND ((tblPeople.[IncubationClient?])="No") AND ((tblPeople.[Archive?])=No))
ORDER BY tblPeople.LastName;
but when I drop it into my code as follows:-
mySQL = "SELECT tblPeople.FirstName, tblPeople.LastName,
tblPeople.UCLanEmail, tblPeople.[IncludeInEmail?],
tblPeople.[IncubationClient?], tblPeople.[Archive?]"
mySQL = mySQL + "FROM tblPeople "
mySQL = mySQL + "WHERE (((tblPeople.UCLanEmail) <> "") And
((tblPeople.[IncludeInEmail?]) = Yes) And ((tblPeople.[IncubationClient?]) =
False) And ((tblPeople.[Archive?]) = No))"
mySQL = mySQL + "ORDER BY tblPeople.LastName;"
I get a syntax error.
This usually occurs with the brackets of the various "WHERE" clauses but I'm
still not sure on how the Chr$34$ should be used.
All the fields in the WHERE clauses are Yes/No fields.
Any help would be very much appreciated.
thanks
Winger