Hi

Im dont have much experience with access so maybe someone can help me with this:
Im more used to working with MS SQL Server and i wrote a query for access that would work in SQL Server.

Though in access i get an error saying that i have to pass additional parameter. However the parameters name is equal to a table name ("Kase") that i use in INNER JOIN.

Here is the query:


SELECT "
Kase.ID,Kase as name "
,Kase.KaseBezPVN as KaseBezPVN"
,Kase.KasePVN as KasePVN"
,Kase.KaseArPVN as KaseArPVN"
,Karte.KarteBezPVN as KarteBezPVN"
,Karte.KartePVN as KartePVN"
,Karte.KarteArPVN as KarteArPVN"
FROM "

( "
SELECT "
sections.ID, max(sections.name) as name "
,Round(sum(services.Price),2) as KaseBezPVN"
,Round(sum(services.PVN),2) as KasePVN"
,Round(sum(services.Price+services.PVN),2) as KaseArPVN"
FROM "
(sections"
INNER JOIN services ON sections.ID=services.SectionID)"
INNER JOIN visits ON services.ID=visits.ServiceID"
WHERE "
visits.PaySort= " & PaySort.Kase
GROUP BY "
sections.ID"
) Kase "

INNER JOIN "

( "
SELECT "
sections.ID, max(sections.name) as name "
,Round(sum(services.Price),2) as KarteBezPVN"
,Round(sum(services.PVN),2) as KartePVN"
,Round(sum(services.Price+services.PVN),2) as KarteArPVN"
FROM "
(sections"
INNER JOIN services ON sections.ID=services.SectionID)"
INNER JOIN visits ON services.ID=visits.ServiceID"
WHERE "
visits.PaySort= " & PaySort.Karte
GROUP BY "
sections.ID"


) Karte "

ON Kase.ID=Karte.id "

P.S. The subqueries work fine.