Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Access query for partial record information in 4 fields

Status
Not open for further replies.

svarland

IS-IT--Management
May 16, 2002
6
US
I need to return contacts that have partial address info.
I've set up a series of queries in Access to find records with null values for Street, City, State and Zip (one query for each field)

I then wanted to combine the results of these queries to give me a list of records with any one of these fields being null.

How do I do this?? Can I do it with a single Query?

Thanks for your help,
Scott
 
Try this:

SELECT contacts FROM Your_Table WHERE Street IS NULL OR City IS NULL OR State IS NULL OR Zip IS NULL

where contacts are the fields you want
 
Thanks for your help. The problem with a string of OR Is Null statements is that it also returns the thousands of records that have nothing in them. I don't want these - I only want records with some piece of the address.

Thx!

Here's the SQL from Access

SELECT Contacts_Full.ID, Contacts_Full.Address1, Contacts_Full.City, Contacts_Full.ST, Contacts_Full.Zip

FROM Contacts_Full

WHERE (((Contacts_Full.Address1) Is Null)) OR (((Contacts_Full.City) Is Null)) OR (((Contacts_Full.ST) Is Null)) OR (((Contacts_Full.Zip) Is Null));
 
This may help:

SELECT Contacts_Full.ID, Contacts_Full.Address1, Contacts_Full.City, Contacts_Full.ST, Contacts_Full.Zip

FROM Contacts_Full

WHERE (Contacts_Full.Address1 Is Null OR Contacts_Full.City Is Null OR Contacts_Full.ST Is Null OR Contacts_Full.Zip Is Null) AND NOT (Contacts_Full.Address1 Is Null AND Contacts_Full.City Is Null AND Contacts_Full.ST Is Null AND Contacts_Full.Zip Is Null);



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top