Hello,
I am getting an error 3122. You tried to execute a query that does not include the specified expression 'pfy' as part of an aggregate function. I have been working on this query for a couple of days now and I am hoping to get some help in resolving this error.
The results of my debug.print is :
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,pd.monasdt,pd.mon_shnm,pd.mon_nm,fy.pfy,((pd.mon_shnm) & ' ' & (fy.fy)), ((pd.mon_nm) & ' ' & (fy.pfy)),pd.days,pd.last3mondys,pd.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 dbo_dic_Period AS pd ON fy.rptpd = pd.pd) 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,pd.monasdt,pd.mon_shnm,pd.mon_nm,((pd.mon_shnm) & ' ' & (fy.fy)),((pd.mon_nm) & ' ' & (fy.pfy)),pd.days,pd.last3mondys,pd.lastdayasdt,fy.imp,fy.fy ORDER BY cmp.compmne,fy.uci,fy.rptpd;
Tom
I am getting an error 3122. You tried to execute a query that does not include the specified expression 'pfy' as part of an aggregate function. I have been working on this query for a couple of days now and I am hoping to get some help in resolving this error.
The results of my debug.print is :
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,pd.monasdt,pd.mon_shnm,pd.mon_nm,fy.pfy,((pd.mon_shnm) & ' ' & (fy.fy)), ((pd.mon_nm) & ' ' & (fy.pfy)),pd.days,pd.last3mondys,pd.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 dbo_dic_Period AS pd ON fy.rptpd = pd.pd) 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,pd.monasdt,pd.mon_shnm,pd.mon_nm,((pd.mon_shnm) & ' ' & (fy.fy)),((pd.mon_nm) & ' ' & (fy.pfy)),pd.days,pd.last3mondys,pd.lastdayasdt,fy.imp,fy.fy ORDER BY cmp.compmne,fy.uci,fy.rptpd;
Tom
Code:
strSQL = "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,pd.monasdt,pd.mon_shnm,pd.mon_nm,fy.pfy" & _
",((pd.mon_shnm) & ' ' & (fy.fy)), ((pd.mon_nm) & ' ' & (fy.pfy)),pd.days,pd.last3mondys,pd.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 dbo_dic_Period AS pd ON fy.rptpd = pd.pd) INNER JOIN PROC_ReportQueue AS rq ON fy.clntid = rq.clntid " & _
"WHERE (((fy.clntid) = " & (liClntID) & ")) " & _
"GROUP BY cl.compid,cmp.compmne,cmp.compdesc,fy.clntid,fy.uci,cl.clntname,fy.rptpd,fy.rptpddiff,fy.fy" & _
",fy.fydiff,fy.fyord,pd.monasdt,pd.mon_shnm,pd.mon_nm,((pd.mon_shnm) & ' ' & (fy.fy))" & _
",((pd.mon_nm) & ' ' & (fy.pfy)),pd.days,pd.last3mondys,pd.lastdayasdt,fy.imp,fy.fy " & _
"ORDER BY cmp.compmne,fy.uci,fy.rptpd;"