I have a query that takes the first three digits of a 6 digit postal code as a Criteria. However, if no digits are added I want all records to return as if there was no criteria.
I am using an IIF statement with a Is Not Null but the problem is, if it is NULL I can't return all records.
Here is my criteria:
Code:
Like IIf([Forms]![frmOptions]![PostalCode] Is Not Null,[Forms]![frmOptions]![PostalCode] & "*","*")
I have tried:
Code:
Like IIf([Forms]![frmOptions]![PostalCode] Is Not Null,[Forms]![frmOptions]![PostalCode] & "*",([tblPatient].[Postal]) Like "*" Or ([tblPatient].[Postal]) Is Null)
Like IIf([Forms]![frmOptions]![PostalCode] Is Not Null,[Forms]![frmOptions]![PostalCode] & "*",([tblPatient].[Postal]) Like "*")
Like IIf([Forms]![frmOptions]![PostalCode] Is Not Null,[Forms]![frmOptions]![PostalCode] & "*",([tblPatient].[Postal]) Is Null)
As you can guess, the postal code comes from the tblPatient.
Am I missing something? It works well with the "*", it just doesn't capture if no postal code is added.
Thanks!