Run-time error 3061 - Too few parameters. Expected 1

ria.arora

Registered User.
Local time
Today, 16:29
Joined
Jan 25, 2012
Messages
109
Dear All,

I'm having wiered issue with one of my SQL.

Below SQL I'm executing from VBA, which is throwing error "Run-time error 3061 - Too few parameters. Expected 1"

Code:
SELECT tbl_Bankers_Mapping.[GMIS Revenue Producer], SUM([Qtr Annuity Income]) - SUM(NZ([Qtr Annuity Oneoff],0))/3 AS [QtrAnnuity] FROM tbl_Consol_Monthly_Revenue_Split AS CMR INNER JOIN tbl_Bankers_Mapping ON CMR.[Private Banker] = tbl_Bankers_Mapping.[GMIS Revenue Producer] WHERE [YearMonth] = '201209' AND [Region 2]= 'South Asia' AND tbl_Bankers_Mapping.[Exclude] IN (False) AND CMR.[Private Banker] LIKE "*"  GROUP BY tbl_Bankers_Mapping.[GMIS Revenue Producer] ,[Region 2] ORDER BY [Region 2], tbl_Bankers_Mapping.[GMIS Revenue Producer]

If I run same SQL in Backend Database (Access 2007) then it runs without any error.

If I takeout - SUM(NZ([Qtr Annuity Oneoff],0)) from above query then it works fine. Can someone tell me what's wrong I'm doing over here.

Regards
 
If you put this query inside a Normal Access Query window are you able to get the desired result? Try a Debug.Print before you execute the Query that will show how it is actually understood by the DB.. So you will be able to see something there..
 
Hi Paul

Yes I'm able to run the query from Normal Access Query window and got correct result as well.
 
Try switching the Views as the problem might occur when you are missing parentheses.. Also what method are you using to execute the SQL??
 
using below syntex

Set rsTmp = gsPnPDatabase.OpenRecordset(strSelectSQL)
 
That's the one which I posted in my first post

Code:
SELECT tbl_Bankers_Mapping.[GMIS Revenue Producer], SUM([Qtr Annuity Income]) - SUM(NZ([Qtr Annuity Oneoff],0))/3 AS [QtrAnnuity] FROM tbl_Consol_Monthly_Revenue_Split AS CMR INNER JOIN tbl_Bankers_Mapping ON CMR.[Private Banker] = tbl_Bankers_Mapping.[GMIS Revenue Producer] WHERE [YearMonth] = '201209' AND [Region 2]= 'South Asia' AND tbl_Bankers_Mapping.[Exclude] IN (False) AND CMR.[Private Banker] LIKE "*"  GROUP BY tbl_Bankers_Mapping.[GMIS Revenue Producer] ,[Region 2] ORDER BY [Region 2], tbl_Bankers_Mapping.[GMIS Revenue Producer]
 

Users who are viewing this thread

Back
Top Bottom