r937 & bombboy,
I changed the query to read:
<cfquery name="getAtRisk" datasource="ARENA" dbtype="ODBC">
SELECT AccidentDate, SSN, AccType
FROM getAggregateAccComposite;
</cfquery>
These are the only three fields I need to see. This is a UNION query in Access.
The exact error is:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
Hint: The cause of this error is usually that your query contains a reference to a field which does not exist. You should verify that the fields included in your query exist and that you have specified their names correctly.
SQL = "SELECT AccidentDate, SSN, AccType FROM getAggregateAccComposite;"
Data Source = "ARENA"
This is the SQL I'm using for getAggregateAccComposite
SELECT AccHistory.AccDate, AccHistory.iSSN, AccHistory.Type_Desc
FROM AccHistory
WHERE (((AccHistory.AccDate) Between Now() And Date()-730) AND ((AccHistory.iSSN)<>"null"))
UNION SELECT AccInjLog_WO_Matching_AccHistory.AccidentDate, AccInjLog_WO_Matching_AccHistory.SSN, AccInjLog_WO_Matching_AccHistory.AccType
FROM AccInjLog_WO_Matching_AccHistory
WHERE (((AccInjLog_WO_Matching_AccHistory.AccidentDate) Between Now() And Date()-730) AND ((AccInjLog_WO_Matching_AccHistory.AccType)<>"Incident"));
Each section of the UNION works in CF when it's not joined but as soon as add the UNION it throws the error about field names not existing. They do.
I guess I may as well post the SQL for AccInjLog_WO_Matching_AccHistory too:
SELECT AccInjLog.AccidentDate, AccInjLog.SSN, AccInjLog.AccType
FROM AccInjLog LEFT JOIN AccHistory ON AccInjLog.SSN = AccHistory.iSSN
WHERE (((AccInjLog.AccidentDate) Is Not Null) AND ((AccInjLog.SSN)<>"999999999") AND ((AccHistory.iSSN) Is Null));
I hope you can see what I'm doing wrong as this is driving me nuts and I'm running out of time...Thanks for everything.