query to filter records

G

Guest

I created a query where the user can type in the firs couple of letters of
the name (or phone or clientID) and the underlying subform/query will be
filtered based on the query. The problem is that if the client does not have
a value in one of the fields (first name and home phone are not manditory)
entered they don't show on the query. I tried to offer Null & "" values but
if the client is missing a phone number they are still excluded from the
query. Can anyone help?

SELECT Main.ClientID, Main.[Last Name], Main.[First Name], Main.[Home
Phone], Main.Address, Main.City
FROM Main
WHERE (((Main.ClientID) Like [forms].[Frm_findClient].[ClientID] & "*") AND
((Main.[Last Name]) Like [forms].[Frm_findClient].[LastName] & "*") AND
((Main.[First Name]) Like [forms].[Frm_findClient].[FirstName] & "*" Or
(Main.[First Name]) Like "IsNull" Or (Main.[First Name]) Like "") AND
((Main.[Home Phone]) Like [forms].[Frm_findClient].[HomePhone] & "*" Or
(Main.[Home Phone]) Like "IsNull" Or (Main.[Home Phone]) Like ""));
 
J

John Vinson

please ignore -- solved my own problem Or Like "IsNull" should read Or Is Null

Well... unless you have the text string "IsNull" in some records and
want to find it... <g>

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top