Null Group Fields Not Equal to Null Non-Grouped Fields

Null Group Fields Not Equal to Null Non-Grouped Fields

Post by Q2hlcnlsIE » Fri, 29 Apr 2005 09:56:03


First query is a select query with multiple tables as input. Primary input
table has text and numeric fields. Text fields are FSTYLE, FCOLOR, GSTYLE,
and GCOLOR. Output uses those same field names. A numeric field,
SeamedStatusValue, is created by the query. Depending on the joined tables,
each row from the primary table may have more than one output row. In this
instance the primary table has 31 rows and the output has 57 rows.

Second query is a select query with the first query as input. It groups on
FSTYLE, FCOLOR, GSTYLE, and GCOLOR, and selects MIN of SeamedStatusValue.
The number of rows output should be (and is) the same as the primary table
used in the first query.

Third query is a select query with the first query and second query as
input. They are joined on FSTYLE, FCOLOR, GSTYLE, GCOLOR, and
SeamedStatusValue using "Only include rows where the joined fields from both
tables are equal."

I expect to get 31 rows from the third query, but I am only getting 29. The
two records that are missing are the ones where GSTYLE and GCOLOR are null in
the primary table. I thought that maybe the grouped fields weren't
evaluating to null, but I tested the first query GSTYLE and GCOLOR for null
and they matched and I tested the second query GSTYLE and GCOLOR for null and
they matched.

I even changed the second query to make a table and then use that table
instead of the second query as input to the third query and came up with the
same results.

I have searched Microsoft Access 97 support and the newsgroup and found
nothing that seems relevant. Can anyone help me?

Thanks in advance,
--
Cheryl
 
 
 

Null Group Fields Not Equal to Null Non-Grouped Fields

Post by Ken Snell » Fri, 29 Apr 2005 11:03:31

Do I understand correctly that your queries are joining the tables using the
fields where a Null value may be present? If yes, a Null value in a joining
field will always mean "no match" and the record with that Null value will
not be selected by the query.

It's possible to use calculated fields in place of the real fields for the
joining, such as:
MyJoinField: Nz(RealFieldName, "AnArbitraryValueThatWon'tMatch")

Then join the tables using the above field and not the real field.

--

Ken Snell
<MS ACCESS MVP>

 
 
 

Null Group Fields Not Equal to Null Non-Grouped Fields

Post by Q2hlcnlsIE » Sat, 30 Apr 2005 01:10:05

Thank you, thank you, thank you!!! I spent hours on this yesterday, reading
and testing. Nothing seemed to work. You have made my morning.
 
 
 

Null Group Fields Not Equal to Null Non-Grouped Fields

Post by Ken Snell » Sat, 30 Apr 2005 08:22:01

ou're welcome.

--

Ken Snell
<MS ACCESS MVP>

"Cheryl Lamonds" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...