This is the relevant SQL:
strSQL_SRC = "SELECT tblGroupEmailType.GroupEmailTypeID, tblGroupEmailType.GroupID, " _
& "full_PGAL_Sth_Master.[Office-Email], " _
& "ztNumOfOfficeEmailAddrsForGroupID.[# of Office Email Addr] " _
& "FROM full_PGAL_Sth_Master " _
& "INNER JOIN tblGroupEmailType " _
& "ON full_PGAL_Sth_Master.GroupID = tblGroupEmailType.GroupID " _
& "INNER JOIN ztNumOfOfficeEmailAddrsForGroupID " _
& "ON tblGroupEmailType.GroupID = ztNumOfOfficeEmailAddrsForGroupID.GroupID " _
& "WHERE tblGroupEmailType.GroupID = " & lngGroupID
When I get to the line where the recordset is opened based upon the above SQL, I receive the following error message:
Err.Number: -2147217900 Err.Descr: Syntax error (missing operator) in query expression 'full_PGAL_Sth_Master.GroupID = tblGroupEmailType.GroupID INNER JOIN ztNumOfOfficeEmailAddrsForGroupID ON tblGroupEmailType.GroupID = ztNumOfOfficeEmailAddrsForGroupID.GroupI'.
I looked very carefully at the code and I cannot spot anything.
I also created a query with the same tables, relationships and fields being returned. I supplied a specific number for the variable lngGroupID and that worked fine.
Maybe there is a missing space or something, but I can't see anything.
lngGroupIDcontains only digits? If you Debug.PrintstrSQL_SRCcan you run it in Access directly?