问题
First of all thank you for your time and sorry if some issues are unclear, this is my first message here.
I'm having a problem with a custom search form I have made on ACCESS 2007.
Here is my database:

Here is my search form:

The main issue I have is that whenever I enter values in firstname, lastername, address, etc. It works totally fine.
But as soon as I get to work phone, mobile or email, it doesn't show me "Florence Fluflo" because her fields are blank for these categories.
Now I have tried in the "Criteria" of the field Work phone to put these:
LIKE ""
LIKE "*" & [Forms]![frm_search]![WorkPhone1] & "*" OR "IsNull"
=" " OR =""
LIKE " "
LIKE "*"
Nothing works... and it's pretty weird because I have done SQL and the SQL statement looks perfectly fine:
SELECT CLIENTS.First_name,
CLIENTS.Surname,
CLIENTS.Address,
CLIENTS.Suburb,
CLIENTS.Postcode,
CLIENTS.Home_phone,
CLIENTS.Work_phone
FROM CLIENTS
WHERE (((CLIENTS.First_name) Like "*" & [Forms]![frm_search]![Firstname1] & "*")
AND ((CLIENTS.Surname) Like "*" & [Forms]![frm_search]![LastName1] & "*")
AND ((CLIENTS.Address) Like "*" & [Forms]![frm_search]![Address1] & "*")
AND ((CLIENTS.Suburb) Like "*" & [Forms]![frm_search]![Suburb1] & "*")
AND ((CLIENTS.Postcode) Like "*" & [Forms]![frm_search]![Postcode1] & "*")
AND ((CLIENTS.Home_phone) Like "*" & [Forms]![frm_search]![HomePhone1] & "*")
AND **((CLIENTS.Work_phone) Like "*" & [Forms]![frm_search]![WorkPhone1] & "*" OR (CLIENTS.Work_phone) Like ""))**;
回答1:
If you write "IsNull"
(in quotes), it will be considered as a string. So, the proper way to verify if a field is null would be like this IS NULL
That means all you need to do for your thing to work is to write
OR IS NULL
after your LIKE
statement
来源:https://stackoverflow.com/questions/9814016/access-2007-search-form-does-not-return-all-values-because-of-a-blank-field-can