S
stainless
I have been writing a long query to join, by union, several other
table queries, thus combining similar data into one query.
For example, I have an AGE column in "Table 1 Query" (selects data
from Table 1 based on some specific criteria) and I am also have an
AGE and INFANT column in "Table 2 Query" (selects data from Table 2
based on specific criteria).
The AGE field and the INFANT field in both tables are dataytype TEXT:
i.e. Table 1 - AGE datatype TEXT
Table 2 - AGE datatype TEXT, INFANT datatype TEXT
There are no nulls in the columns.
The Union statement is attempting to Union:
[Table 1 Query].[AGE]
with
IIF([Table 2 Query].[AGE]>0,Cstr([Table 2 Query].[AGE]),IIF([Table 2
Query].[INFANT]<>"",Cstr([Table 2 Query].[INFANT]),Cstr([Table 2
Query].[AGE]))),
This is resuting in a "datatype mismatch in criteria expression".
However, if I run the table 2 query select statment on its own, it
works fine. So there is some issue in combining the columns from the 2
queries. But they look to me like they would both be text. Any ideas
why this would be treated as a mismatch?
table queries, thus combining similar data into one query.
For example, I have an AGE column in "Table 1 Query" (selects data
from Table 1 based on some specific criteria) and I am also have an
AGE and INFANT column in "Table 2 Query" (selects data from Table 2
based on specific criteria).
The AGE field and the INFANT field in both tables are dataytype TEXT:
i.e. Table 1 - AGE datatype TEXT
Table 2 - AGE datatype TEXT, INFANT datatype TEXT
There are no nulls in the columns.
The Union statement is attempting to Union:
[Table 1 Query].[AGE]
with
IIF([Table 2 Query].[AGE]>0,Cstr([Table 2 Query].[AGE]),IIF([Table 2
Query].[INFANT]<>"",Cstr([Table 2 Query].[INFANT]),Cstr([Table 2
Query].[AGE]))),
This is resuting in a "datatype mismatch in criteria expression".
However, if I run the table 2 query select statment on its own, it
works fine. So there is some issue in combining the columns from the 2
queries. But they look to me like they would both be text. Any ideas
why this would be treated as a mismatch?