Dear Dave:
See my comments in-line below.
Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
Thanks for the detailed response. Just to clarify, yes the IsOnAddress,
IsOffAddress and IsMonAddress are Yes/No fields and are mutually exclusive
(only zero or one of the three flags will be set). If no flags are set then
I want the row to be excluded from the query results.
What I suggested will do exactly that. It would also exclude any row
with more than on "Yes" value.
When you say it may be better to change the table what would you suggest?
Combine the 3 flags into one field?
Yes. The table would look just like what the UNION ALL query does.
Please try running this and you'll see. A combo box would work here
instead of 3 columns of check boxes. You would pick any one of 3
values (or more if it could ever expand) which excludes the other 2.
It would store this in the table which creates the crosstab column
headings.
I'm not sure you understand my requirements exactly. Each row has an
Address text field. The 3 flags indicate what type of address that Address
field represents: an On address, an Off address, or a Monitor address.
I really believe I got that.
I think the basic problem with the crosstab is the fact that I want 3 (?)
column headings and a normal crosstab only allows 1?
A "normal crosstab" allows a variable number of columns, depending on
the number of values in the one column on which it transforms. What
I'm doing is to create this column with the 3 values, so you'll get 3
columns in the crosstab.
I'm trying to do this with subqueries and LEFT OUTER JOINS and it almost
works but it is excluding rows that do not have the IsOnAddress flag set.
Access is changing my LEFT OUTER JOINs to LEFT JOIN when I save the query.
Are they the same thing?
Yes, these are the same thing. I don't know what it is you're doing
with the LEFT OUTER JOIN approach. You don't show much about that
here. But what I suggested should be exactly what you need. Why not
give it a try?