A
Allen Browne
The ideal solution would be to create a single column for the 4 types of
expense, instead of 4 tables. Just include an extra column where the user
chooses the ExpenseType (one of 4 values.) You will find this is much easier
to work with, and much faster. For example, a crosstab query would give you
the report you want (journal-style, with a column for each expense type.)
If you can't do that, you will need to fill the other columns with Null,
e.g.:
SELECT ExpenseID,
ExpenseAmount AS Type1,
IIf(False, 0,Null) AS Type2,
IIf(False, 0, Null) AS Type3,
IIf(False, 0, Null) AS Type4
FROM ExpenseTable1
UNION ALL
SELECT ExpenseID,
IIf(False, 0,Null) AS Type1,
ExpenseAmount AS Type2,
IIf(False, 0, Null) AS Type3,
IIf(False, 0, Null) AS Type4
FROM ExpenseTable2
UNION ALL
....
The IIf() expression is necessary so Access understands the column is
numeric. Of course False will never be True, but the presence of the
alternative is enough to let JET know that this is a Number.
expense, instead of 4 tables. Just include an extra column where the user
chooses the ExpenseType (one of 4 values.) You will find this is much easier
to work with, and much faster. For example, a crosstab query would give you
the report you want (journal-style, with a column for each expense type.)
If you can't do that, you will need to fill the other columns with Null,
e.g.:
SELECT ExpenseID,
ExpenseAmount AS Type1,
IIf(False, 0,Null) AS Type2,
IIf(False, 0, Null) AS Type3,
IIf(False, 0, Null) AS Type4
FROM ExpenseTable1
UNION ALL
SELECT ExpenseID,
IIf(False, 0,Null) AS Type1,
ExpenseAmount AS Type2,
IIf(False, 0, Null) AS Type3,
IIf(False, 0, Null) AS Type4
FROM ExpenseTable2
UNION ALL
....
The IIf() expression is necessary so Access understands the column is
numeric. Of course False will never be True, but the presence of the
alternative is enough to let JET know that this is a Number.