Reputation: 71
I have a union query that pulls together data from a couple other queries. These queries search for data based on the date that is entered on a form.
I have been using this query for the longest time, and even have backups of this from months ago, when I know it worked, but suddenly, this error pops up instead.
The Union Query
SELECT MnthlyFireExCnt.ProjectCriteria AS Project, MnthlyFireExCnt.CountOfFire_Extinguisher_Location_ID_ AS NumberOf, MnthlyFireExCnt.Type
FROM MnthlyFireExCnt
UNION ALL
SELECT MnthlyFrstAdCnt.ProjectCriteria, MnthlyFrstAdCnt.CountOfForm_Record_Number, MnthlyFrstAdCnt.Type
FROM MnthlyFrstAdCnt
UNION ALL
SELECT MnthlyIncCnt.ProjectCriteria, MnthlyIncCnt.CountOfDate_Time_Reported, MnthlyIncCnt.Occurrence
FROM MnthlyIncCnt
UNION ALL
SELECT MnthlyJHACnt.ProjectCriteria, MnthlyJHACnt.CountOfDate, MnthlyJHACnt.Type
FROM MnthlyJHACnt
UNION ALL
SELECT MnthlySiteObsvCnt.ProjectCriteria, MnthlySiteObsvCnt.CountOfTime, MnthlySiteObsvCnt.Type
FROM MnthlySiteObsvCnt
UNION ALL
SELECT MnthlySSICnt.ProjectCriteria, MnthlySSICnt.CountOfDate, MnthlySSICnt.InspCriteria
FROM MnthlySSICnt
UNION ALL
SELECT MnthlyToolTCnt.ProjectCriteria, MnthlyToolTCnt.CountOfDate_Time, MnthlyToolTCnt.Type
FROM MnthlyToolTCnt
UNION ALL SELECT MnthlyWSSCnt.ProjectCriteria, MnthlyWSSCnt.CountOfForm_Record_Number, MnthlyWSSCnt.Type
FROM MnthlyWSSCnt;
And this is one of the query that pulls the data together for the Union Quer.
SELECT SSIReportsProjectCrit.ProjectCriteria, Count(MnthlyFireExData.Fire_Extinguisher_Location_ID_) AS CountOfFire_Extinguisher_Location_ID_, "Fire Extinguisher(s) Inspected" AS Type
FROM SSIReportsProjectCrit LEFT JOIN MnthlyFireExData ON SSIReportsProjectCrit.ProjectCriteria = MnthlyFireExData.Site_Location
GROUP BY SSIReportsProjectCrit.ProjectCriteria, "Fire Extinguisher(s) Inspected";
This query works no problem. It is pulling up the data.
Any help would be extremely appreciated!
Upvotes: 1
Views: 76
Reputation: 5838
Test that the unioned queries work individually.
In my experience, I have found that this can also be due to corruption of the Access files. Sometimes, I would check for this first if I couldn't find any other logical explanation. In such cases, what has worked for me has been:
Upvotes: 0