I have some code which dynamically assembles the following query:<br>Select ItAcCd, ItTxNum, ItTxDate, ItAmt, ItXrefAc, BkTxn.TxNarr From BkItem, BkTxn Where BkTxn.TxNum = BkItem.ItTxNum And BkItem.ItAcCd = 'NCA'<br>I know it generates exactly this because in desperation I inserted <cfoutput>#QueryString#</cfoutput> to see what was going on.<br>'NCA' is the dynamic bit, derived from user input.<br><br>This gives the following error:<br>ODBC Error Code = 37000 (Syntax error or access violation)<br>[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'BkTxn.TxNum = BkItem.ItTxNum And BkItem.ItAcCd = ''NCA'''.<br>SQL = "Select ItAcCd, ItTxNum, ItTxDate, ItAmt, ItXrefAc, BkTxn.TxNarr From BkItem, BkTxn Where BkTxn.TxNum = BkItem.ItTxNum And BkItem.ItAcCd = ''NCA'' Order by ItTxDate, BkTxn.TxNum"<br><br>I can't see what's wrong. I copied the generated query into VB's Visdata Add-in and it ran OK!<br><br>Can anyone help?<br>