I am assembling fields into text using expressions.
The following code produces the error message: 3075 Syntax error (missing operator)in query expression '[tblEpr].[SsnID]=0 AND [tblEpr].[RecID]= & [Forms]![frmRec]![RecID] &'.
The message occurs on the final line of code below:
Here is the SQL query within the VBA generated query above.
FYI: the expression in the query produces text something like this: Child under 16: Free (ID req.).
Formerly I was getting an error message about an Extra ) but when I stripped out the parentheses and quotes to simplify the query the error message changed to Syntax error.
The query seems to execute OK so If there is no solution, I will ignore the error, but I prefer to fix it.
Thank you
The following code produces the error message: 3075 Syntax error (missing operator)in query expression '[tblEpr].[SsnID]=0 AND [tblEpr].[RecID]= & [Forms]![frmRec]![RecID] &'.
The message occurs on the final line of code below:
Code:
Dim strSQL As String
Dim db As DAO.Database
Dim qdfEpr0 As DAO.QueryDef
Set db = Application.CurrentDb
Set qdfEpr0 = db.QueryDefs("qcnEprSsn0No1")
strSQL = "SELECT * FROM qcnEpr WHERE [tblEpr].[SsnID]=0 AND [tblEpr].[RecID]= & [Forms]![frmRec]![RecID] & ;"
qdfEpr0.SQL = strSQL
Here is the SQL query within the VBA generated query above.
SQL:
SELECT tblEpr.RecID, tlkEprGrp.EprGrp, [EprCat] & IIf([Age]="n/a","",(" " & [Age])) & " ("+[EprCmnt]+")" & ": " & IIf([EntryPrice]=0,"Free",Format([EntryPrice],"Currency")) & IIf([IdReq]=No,""," (ID req.)") AS CatAgeEpr, tblEpr.SsnID, tblEpr.EprGrpID
FROM tlkEprGrp INNER JOIN (tlkEprCat INNER JOIN (tlkAge INNER JOIN tblEpr ON tlkAge.AgeID = tblEpr.AgeID) ON tlkEprCat.EprCatID = tblEpr.EprCatID) ON tlkEprGrp.EprGrpID = tblEpr.EprGrpID;
FYI: the expression in the query produces text something like this: Child under 16: Free (ID req.).
Formerly I was getting an error message about an Extra ) but when I stripped out the parentheses and quotes to simplify the query the error message changed to Syntax error.
The query seems to execute OK so If there is no solution, I will ignore the error, but I prefer to fix it.
Thank you