G
Guest
Hello all,
Here is my query is SQL
SELECT TblClientData.*
FROM TblClientData
WHERE (((TblClientData.Delivery_Address) Like "*" &
[Forms]![AFrmCustomerSearch].[TxtAddress] & "*") AND ((TblClientData.City)
Like "*" & [Forms]![AFrmCustomerSearch].[TxtCity] & "*") AND
((TblClientData.State) Like "*" & [Forms]![AFrmCustomerSearch].[CmbState] &
"*") AND ((TblClientData.ZIP4) Like "*" &
[Forms]![AFrmCustomerSearch].[TxtZip] & "*"));
With this I had hoped that a user could type in a variey of search criteria
and the query returns the best possible results and it works for the most
part. Unless that is, one of the fields happens to be blank, if that is the
case it renders the whole record unsearchable.
So if I leave all fields on the form blank and click search I would want to
see all records with anything in any of the searched fields but intead I see
all records where the value is not null in all of the searched fields. I
tried adding or is null to the field criteria but that returns too many
results. Is there a way I can do this without creating a ton of small
queries? Thanks!
Here is my query is SQL
SELECT TblClientData.*
FROM TblClientData
WHERE (((TblClientData.Delivery_Address) Like "*" &
[Forms]![AFrmCustomerSearch].[TxtAddress] & "*") AND ((TblClientData.City)
Like "*" & [Forms]![AFrmCustomerSearch].[TxtCity] & "*") AND
((TblClientData.State) Like "*" & [Forms]![AFrmCustomerSearch].[CmbState] &
"*") AND ((TblClientData.ZIP4) Like "*" &
[Forms]![AFrmCustomerSearch].[TxtZip] & "*"));
With this I had hoped that a user could type in a variey of search criteria
and the query returns the best possible results and it works for the most
part. Unless that is, one of the fields happens to be blank, if that is the
case it renders the whole record unsearchable.
So if I leave all fields on the form blank and click search I would want to
see all records with anything in any of the searched fields but intead I see
all records where the value is not null in all of the searched fields. I
tried adding or is null to the field criteria but that returns too many
results. Is there a way I can do this without creating a ton of small
queries? Thanks!