Like query from text box on form

  • Thread starter Thread starter Francis
  • Start date Start date
F

Francis

Thanks,

I tried the - Like "*" & [Forms]![frmContact]!
[txtCompany] & "*" - and also used the Nz because I have
some records that are empty in either the company or
contact name fields. Even with the Nz the empty records
are not returned.

Could you shed any light?

Francis
 
You would need to either convert the null in the Field row ie: [Company] &
""
or add " or Is Null" to the criteria.
 
Thanks,

I tried the - Like "*" & [Forms]![frmContact]!
[txtCompany] & "*" - and also used the Nz because I have
some records that are empty in either the company or
contact name fields. Even with the Nz the empty records
are not returned.

Could you shed any light?

Francis

Try

LIKE "*" & [Forms]![frmContact]![txtCompany] & "*" OR ([Company] IS
NULL AND [Forms]![frmContact]![txtCompany] IS NULL)

as a criterion. NULL is not "like" anything, and will not be found
unless you use the IS NULL operation.
 
Back
Top