MS Query 'Too Few Parameters - Expected 2'

okiearcher

New Member
Joined
Sep 19, 2014
Messages
1
Hi all.

Newbie poster here.

I have an Access07 Union query that works great and pulls the data just like I need, in Access. When I try to use the query in Excel07 MS Query to pull the data into a sheet in the workbook, I get the error in the title line. Can someone please shed light on why I might be getting this error in MS Query link?

Thanks for your time.
okiearcher

Here's the SQL (in Access):

SELECT [WMNovarprojects].[StoreNbr] & Format([WMNovarprojects].[Sequence],"000") & [WMNovarProjects].[State] AS Project, Sum(WMNovarProjectPOs.QuoteAmount) AS TotPO, WMNovarProjects.SAP_USE_NBR, WMNovarProjects.ProjectPossessionDate AS PossDate
FROM WMNovarProjects INNER JOIN (Quotes INNER JOIN WMNovarProjectPOs ON Quotes.QuotesID = WMNovarProjectPOs.QuotesID) ON (WMNovarProjects.WMProjID = WMNovarProjectPOs.WMProjID) AND (WMNovarProjects.WMProjID = Quotes.WMProjID)
GROUP BY [WMNovarprojects].[StoreNbr] & Format([WMNovarprojects].[Sequence],"000") & [WMNovarProjects].[State], WMNovarProjects.SAP_USE_NBR, WMNovarProjects.ProjectPossessionDate, WMNovarProjectPOs.POCancelled, Quotes.Revised
HAVING ((([WMNovarprojects].[StoreNbr] & Format([WMNovarprojects].[Sequence],"000") & [WMNovarProjects].[State]) Not Like "999*") AND ((WMNovarProjects.ProjectPossessionDate) Between DateSerial(Year(Date())-1,1,1) And DateSerial(Year(Date())+2,1,1)-1) AND ((WMNovarProjectPOs.POCancelled)=False) AND ((Quotes.Revised)=False))
ORDER BY [WMNovarprojects].[StoreNbr] & Format([WMNovarprojects].[Sequence],"000") & [WMNovarProjects].[State], WMNovarProjects.ProjectPossessionDate;


UNION SELECT [WMNovarprojects].[StoreNbr] & Format([WMNovarprojects].[Sequence],"000") & [WMNovarProjects].[State] AS Project, Sum(WMNovarProjectPOs.QuoteAmount) AS TotPO, WMNovarProjects.SAP_USE_NBR, WMNovarProjects.ProjectPossessionDate
FROM WMNovarProjects INNER JOIN WMNovarProjectPOs ON WMNovarProjects.WMProjID=WMNovarProjectPOs.WMProjID
GROUP BY [WMNovarprojects].[StoreNbr] & Format([WMNovarprojects].[Sequence],"000") & [WMNovarProjects].[State], WMNovarProjects.SAP_USE_NBR, WMNovarProjects.ProjectType, WMNovarProjects.ProjCreatedBy, WMNovarProjects.ProjectPossessionDate
HAVING (((WMNovarprojects.StoreNbr & Format(WMNovarprojects.Sequence,"000") & WMNovarProjects.State) Not Like "999*") And ((WMNovarProjects.ProjectPossessionDate) Between DateSerial(Year(Date())-1,1,1) And DateSerial(Year(Date())+2,1,1)-1));
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,305
Messages
5,836,534
Members
430,437
Latest member
Emilycr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top