View Full Version : Show fields with no data in the query


RexesOperator
01-03-2008, 12:00 PM
I have two one-many related tables: Transactions and Site Details. Most of the Transactions information can be filled in first, and then the Site Details filled in when they are ready.

How do I get a query based on both tables to show those transactions with missing site details? I have tried IsNull(SiteName) in the SiteName field in the Design View, but I don't get any results at all (for records with no SiteName). The answers I've seen in Google seem to be variations on the theme, but I am probably missing something simple (as usual).

I orignally posted this with a question about tracking revision history. I thought it might be a similar solution, since I want to add information to the blank fields when the information becomes available. But I need to find those transactions WITH blank fields first.

pbaldy
01-03-2008, 12:19 PM
I assume there's a common field, so try:

SELECT Blah
FROM Transactions
WHERE CommonField NOT IN(SELECT DISTINCT CommonField FROM SiteDetails)

You could also play with the unmatched query wizard and see if that gets you what you want.

RexesOperator
01-03-2008, 01:56 PM
I should have said I was using A2003. It would be nice to have an unmatched query wizard. There is a common field (TransactionsID), but I want to find the blank fields in the SiteDetails table, so searching for the common field won't help

I will try your SELECT and see if that works.

pbaldy
01-03-2008, 02:03 PM
2003 has that wizard. My assumption was that there would not be a record in the SiteDetails table for these records. If you've got empty records, you'd want something like:

SELECT Blah
FROM SiteDetails
WHERE SiteName Is Null