Hi,
I have a form which prompts the user for information and runs a query based on this information. Sometimes the user will be leaving some of the fields on the form blank but I still want my query to return all the records so I have the following in the criteria field of my query
The idea is that if the user leaves the Srch_CuttingStatus field blank the query will still return all records. However it'll only return records with something in that field and will not return records with fields that contain null values i.e. it doesn't return all records.
Using the following solution doesn't work either I'm afraid because if the user does specify criteria this will return all the records that contain null vals also which is just as undesirable.
Can someone help me out please!
Thanks,
Liam
I have a form which prompts the user for information and runs a query based on this information. Sometimes the user will be leaving some of the fields on the form blank but I still want my query to return all the records so I have the following in the criteria field of my query
Code:
Like IIf(IsNull([Forms]![frmViewSearch]![Srch_CuttingStatus]),"*",[Forms]![frmViewSearch]![Srch_CuttingStatus])
The idea is that if the user leaves the Srch_CuttingStatus field blank the query will still return all records. However it'll only return records with something in that field and will not return records with fields that contain null values i.e. it doesn't return all records.
Using the following solution doesn't work either I'm afraid because if the user does specify criteria this will return all the records that contain null vals also which is just as undesirable.
Code:
Is Null Or Like IIf(IsNull([Forms]![frmViewSearch]![Srch_CuttingStatus]),"*",[Forms]![frmViewSearch]![Srch_CuttingStatus])
Can someone help me out please!
Thanks,
Liam