I tried the suggested update to my query but unfortunately it did not
display the correct result.
Hence to simplify fault finding the problem. I created two tables, a query
and a form / subform based on the example code we have been discussing.
Using test data so that Record 2 of table A would be flagged as it did not
have a Y in the colour field but did have a tick in Received field resulted
in no record returned by the query.
(No record returned at all, of any type)
I have supplied the following information as I must be overlooking
something.
Copy and pasted
SELECT A.Date_R, A.Received, A.ID, B.Colour
FROM A INNER JOIN B ON A.Main = B.Main
WHERE A.Received=-1 AND B.Colour <>"Y";
Table A has the following fields and data types
Date_R >>> Date/Time
Received >>> Yes/No
ID >>> Text
Main>>> AutoNumber>>> PK Field
Record 1 has the following data
Date_R shows 02/02/2010
Received shows Tick
ID shows 2
Main shows 1
Record 2 02/02/2010, Tick, 2, 2
Table B has the following fields and data types
IDNo >>> AutoNumber >>>PK Field
Main >>> Number
Colour>>> Text
Record 1 has the following data
IDNo shows 1
Main shows 1
Colour shows Y
[snip]
Your query will not return any records because tblA record 1
joins with rblB record 1 but is filtered out because colour
= Y.
tblA record 2 does not join to a record in tblB so the
query's colour field contains Null. It is very important to
understand that Null kind of represents that the value is
**unknown**. As such, you can not ever say that an unknown
value is either equal or not equal to any other value, not
even another unknown value. Do this record is filtered out
because you can not say that a Null colour is not equal to Y
If you want to return records from tblA when the colour fiel
is Null, then you have to do something to allow for that.
This is one way:
WHERE A.Received=-1 AND (B.Colour <>"Y" Or B.Colour Is Null)
Note that those parenthesis are needed to get the And and Or
to be evaluated in the right order.