Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error 3135

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
OK, I am now getting an error 3135 syntax error in Join operation. I have added the new line command per Andy's request. Any help is appreciated.

Tom

Code:
 strSQL = "INSERT INTO PROC_FYInfo(compid,compmne,compdesc,clntid,uci,clntname,rptpd,rptpddiff,fy,fydiff" & vbNewLine & _
                                    ",fyord,MnthAsDt,mon,monfull,yr,MonShNm,MonFullNm,days,last3mondys,lastdayasdt,impfl) " & vbNewLine & _
                      "SELECT cl.compid,cmp.compmne,cmp.compdesc,fy.clntid,fy.uci,cl.clntname,fy.rptpd,fy.rptpddiff" & vbNewLine & _
                        ",fy.fy,fy.fydiff,fy.fyord,fy.monasdt,fy.mon_shnm,fy.mon_nm,fy.pfy" & vbNewLine & _
                        ",((fy.mon_shnm) & ' ' & (fy.fy)), ((fy.mon_nm) & ' ' & (fy.pfy)),fy.days,fy.last3mondys,fy.lastdayasdt,fy.imp " & vbNewLine & _
                    "FROM ((dbo_rpt_FYInfo fy " & vbNewLine & _
                        "INNER JOIN (dbo_rpt_Clients AS cl " & vbNewLine & _
                        "INNER JOIN dbo_dic_Company AS cmp ON cl.compid = cmp.compid) ON fy.clntid = cl.clntid) " & vbNewLine & _
                        "INNER JOIN PROC_ReportQueue AS rq ON fy.clntid = rq.clntid " & vbNewLine & _
                    "WHERE (((fy.clntid) = " & (liClntID) & ")) " & vbNewLine & _
                    "GROUP BY cl.compid,cmp.compmne,cmp.compdesc,fy.clntid,fy.uci,cl.clntname,fy.rptpd,fy.rptpddiff,fy.fy" & vbNewLine & _
                    ",fy.fydiff,fy.fyord,fy.monasdt,fy.mon_shnm,fy.mon_nm,((fy.mon_shnm) & ' ' & (fy.fy))" & vbNewLine & _
                    ",((fy.mon_nm) & ' ' & (fy.pfy)),fy.days,fy.last3mondys,fy.lastdayasdt,fy.imp,fy.fy,fy.pfy " & vbNewLine & _
                    "ORDER BY cmp.compmne,fy.uci,fy.rptpd;"
            Debug.Print strSQL

The results of the debug.print

INSERT INTO PROC_FYInfo(compid,compmne,compdesc,clntid,uci,clntname,rptpd,rptpddiff,fy,fydiff
,fyord,MnthAsDt,mon,monfull,yr,MonShNm,MonFullNm,days,last3mondys,lastdayasdt,impfl)
SELECT cl.compid,cmp.compmne,cmp.compdesc,fy.clntid,fy.uci,cl.clntname,fy.rptpd,fy.rptpddiff
,fy.fy,fy.fydiff,fy.fyord,fy.monasdt,fy.mon_shnm,fy.mon_nm,fy.pfy
,((fy.mon_shnm) & ' ' & (fy.fy)), ((fy.mon_nm) & ' ' & (fy.pfy)),fy.days,fy.last3mondys,fy.lastdayasdt,fy.imp
FROM ((dbo_rpt_FYInfo fy
INNER JOIN (dbo_rpt_Clients AS cl
INNER JOIN dbo_dic_Company AS cmp ON cl.compid = cmp.compid) ON fy.clntid = cl.clntid)
INNER JOIN PROC_ReportQueue AS rq ON fy.clntid = rq.clntid
WHERE (((fy.clntid) = 37))
GROUP BY cl.compid,cmp.compmne,cmp.compdesc,fy.clntid,fy.uci,cl.clntname,fy.rptpd,fy.rptpddiff,fy.fy
,fy.fydiff,fy.fyord,fy.monasdt,fy.mon_shnm,fy.mon_nm,((fy.mon_shnm) & ' ' & (fy.fy))
,((fy.mon_nm) & ' ' & (fy.pfy)),fy.days,fy.last3mondys,fy.lastdayasdt,fy.imp,fy.fy,fy.pfy
ORDER BY cmp.compmne,fy.uci,fy.rptpd;
 

A 3135 syntax error can mean bad punctuation.

I see 3 opening and 2 closing parens here.
FROM ((dbo_rpt_FYInfo fy
INNER JOIN (dbo_rpt_Clients AS cl
INNER JOIN dbo_dic_Company AS cmp ON cl.compid = cmp.compid) ON fy.clntid = cl.clntid)
INNER JOIN PROC_ReportQueue AS rq ON fy.clntid = rq.clntid

I see 3 opening and 2 closing parens here.
WHERE (((fy.clntid) = 37))


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top