I am trying to create a union query that will combine data from 3 tables. They all use the same type of unique identifier (i.e. StudentID). I keep getting a "Data Type Mismatch in Criteria Expression" when I try to execute it. I have tried running each of the queries separately without issues as well as in pairs. I only get the error when I try to run all 3 together. I think I may have narrowed down the issue to one field (TRS_Scores) which happens to be a calculated field in its query. Here is the sql I have written...
SELECT tblGateStatus_504_FR_CEDLT.[Student ID]
, tblGateStatus_504_FR_CEDLT.[Last Name] as Last_Name
, tblGateStatus_504_FR_CEDLT.[First Name] as First_Name
, tblGateStatus_504_FR_CEDLT.FR_504_CELDT_Score
, NULL as TRS_Scores
, NULL as SBAC_Math
, Null as SBAC_ELA
FROM tblGateStatus_504_FR_CEDLT
Union
SELECT tblPowerSchoolData.[Student ID]
, tblPowerSchoolData.[Last Name] as Last_Name
, tblPowerSchoolData.[First Name] as First_Name
, NULL as FR_504_CELDT_Score
, tblTeacherScoringSheets.[Average Score] AS TRS_Scores
, NULL as SBAC_Math
, Null as SBAC_ELA
FROM tblPowerSchoolData Right JOIN tblTeacherScoringSheets ON tblPowerSchoolData.[Student ID] = tblTeacherScoringSheets.[Student ID]
UNION
SELECT tblPowerSchoolData.[Student ID]
, tblPowerSchoolData.[Last Name] as Last_Name
, tblPowerSchoolData.[First Name] as First_Name
, NULL as FR_504_CELDT_Score
, NULL as TRS_Scores
, tblSBACScores.[SBAC Math 2016] as SBAC_Math
, tblSBACScores.[SBAC ELA 2016] as SBAC_ELA
FROM tblPowerSchoolData INNER JOIN tblSBACScores ON tblPowerSchoolData.[Student ID] = tblSBACScores.[Student ID];
Appreciate any help I can get.
Thanks.