JJINFM
asked on
Access Union Query in Excel
Hi Experts,
I have a union query in Access 2010 that I would like to use in Excel 2010. I can't seem to get this query to show up in the Data Connection. If I try MS Query I get "Too few parameters. Expected 3."
Here is the sql for the union query:
SELECT [Store Info].greatplains AS Store, dbo_dpvHstSalesTotals.Date OfBusiness , "Cash" AS [Desc], dbo_dpvHstSalesTotals.Depo sit AS Amt, "" AS TypeID
FROM [Store Info] INNER JOIN dbo_dpvHstSalesTotals ON [Store Info].RadiantNbr = dbo_dpvHstSalesTotals.FKSt oreId
WHERE ((([Store Info].greatplains)="FTMY") AND ((dbo_dpvHstSalesTotals.Da teOfBusine ss)>#09/01 /2013#))
ORDER BY dbo_dpvHstSalesTotals.Date OfBusiness DESC;
UNION ALL SELECT CompMaster.STORE, dbo_dpvHstGndTender.DateOf Business, UCase([compmaster].[NAME]) AS [Desc], ([Amount]+[TIP]) AS AMT, dbo_dpvHstGndTender.TypeId
FROM CompMaster INNER JOIN ([Store Info] INNER JOIN dbo_dpvHstGndTender ON [Store Info].RadiantNbr = dbo_dpvHstGndTender.FKStor eId) ON (CompMaster.ID = dbo_dpvHstGndTender.TypeId ) AND (CompMaster.STORE = [Store Info].greatplains)
WHERE (((CompMaster.STORE)="FTMY ") AND ((dbo_dpvHstGndTender.Date OfBusiness )>#09/01/2 013#) AND ((dbo_dpvHstGndTender.Type )=3));
Any help is appreciated
jj
I have a union query in Access 2010 that I would like to use in Excel 2010. I can't seem to get this query to show up in the Data Connection. If I try MS Query I get "Too few parameters. Expected 3."
Here is the sql for the union query:
SELECT [Store Info].greatplains AS Store, dbo_dpvHstSalesTotals.Date
FROM [Store Info] INNER JOIN dbo_dpvHstSalesTotals ON [Store Info].RadiantNbr = dbo_dpvHstSalesTotals.FKSt
WHERE ((([Store Info].greatplains)="FTMY")
ORDER BY dbo_dpvHstSalesTotals.Date
UNION ALL SELECT CompMaster.STORE, dbo_dpvHstGndTender.DateOf
FROM CompMaster INNER JOIN ([Store Info] INNER JOIN dbo_dpvHstGndTender ON [Store Info].RadiantNbr = dbo_dpvHstGndTender.FKStor
WHERE (((CompMaster.STORE)="FTMY
Any help is appreciated
jj
ASKER
If I remove that column from the 1st query I get a message that states "The number of columns in the two selected tables or queries of a union query do not match"
I just added that column to the first query to get to the same number of columns that the second query has. There is a value returned in the second query.
I just added that column to the first query to get to the same number of columns that the second query has. There is a value returned in the second query.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Brilliant!! That worked!
Thanks for your help
Thanks for your help
May not be the issue, but may be an issue.