Solved

Syntax error

Posted on 2016-09-11
4
30 Views
Last Modified: 2016-10-02
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)
0
Comment
Question by:VGuerra67
  • 2
4 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points (awarded by participants)
ID: 41793602
Try this.
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] & "'));"

Open in new window

1
 
LVL 84
ID: 41793966
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.
0
 

Author Comment

by:VGuerra67
ID: 41795346
Thanks to both of you
0
 
LVL 84
ID: 41825213
The syntax provided by Norie should resolve the issue
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now