Avatar of VGuerra67
VGuerra67
 asked on

Syntax error

Syntax error for my strSQL string.


Dim db As DAO.Database
Dim rs, rs2 As DAO.Recordset
Dim strSQL, RIGACCT, ClientID, dispname, comp, acctno, bal, exp, expdel, EXPDELDATE, eq, eqdel, EQDELDATE, tu, tudel, tuddate As String
Dim pudate, credotes, newpudate As String

strSQL = "SELECT CREDITREPORT.RIGACCT_FK, CREDITREPORT.CLIENTID_FK, CREDITREPORT.DISPLAYNAME, CREDITREPORT.COMPANYNAME, CREDITREPORT.ACCOUNTNUMBER, CREDITREPORT.BALANCE, CREDITREPORT.EXPERIAN," _
        & " CREDITREPORT.EXPERIANDEL, CREDITREPORT.EXPDELDATE, CREDITREPORT.EQUIFAX, CREDITREPORT.EQUIFAXDEL, CREDITREPORT.EQDELDATE, CREDITREPORT.TRANSUNION, CREDITREPORT.TRANSUNIONDEL, " _
        & "CREDITREPORT.TUDELDATE, CREDITREPORT.PULLEDDATE, CREDITREPORT.CREDREPORTNOTES, CREDITREPORT.NEWPULLEDDATE " _
        & "FROM CREDITREPORT" _
        & "WHERE (((CREDITREPORT.CLIENTID_FK)= & '"[forms]![SubMc_CredRptDE1Frm]![CLIENTID_FK]"' & ) AND ((CREDITREPORT.PULLEDDATE)= & '"[forms]![SubMc_CredRptDE1Frm]![PULLEDDATE_Txt]"' & ));"



Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Microsoft Access

Avatar of undefined
Last Comment
Scott McDaniel (EE MVE )

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Norie

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Scott McDaniel (EE MVE )

Also be aware of your data types. For example, if CLIENTID_FK is a Numeric value you remove the single quotes from Norie's suggestion.
VGuerra67

ASKER
Thanks to both of you
Scott McDaniel (EE MVE )

The syntax provided by Norie should resolve the issue
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23