Hi,
I am trying to collect values from a form and using these as the criteria in a query (which a report will sit on).
To start simply the form has a combo box which the user selects the country to be used in the criteria. Not a problem at all. But what I'm trying to achieve is if the user picks nothing and leaves the box blank then the query should use the wildcard * to select everything.
The following statement in the criteria seems to evaluate the contents of the combo box correctly but will not then use the * to produce a result when the box is Null or 0, etc.
IIf([Forms]![frmCompaniesSelectionFilter]![cboCountries]=Null,([qryCompanyData].[CountryCode]) Like "*",[Forms]![frmCompaniesSelectionFilter]![cboCountries])
If I could I would include a wildcard in the combo box list but unfortunately the table being looked up has two fields: an auto number primary key (CountryCode) and a text field (Country).
Any ideas? %-)
GW.
"If a job's worth doing, it's worth doing twice!"
I am trying to collect values from a form and using these as the criteria in a query (which a report will sit on).
To start simply the form has a combo box which the user selects the country to be used in the criteria. Not a problem at all. But what I'm trying to achieve is if the user picks nothing and leaves the box blank then the query should use the wildcard * to select everything.
The following statement in the criteria seems to evaluate the contents of the combo box correctly but will not then use the * to produce a result when the box is Null or 0, etc.
IIf([Forms]![frmCompaniesSelectionFilter]![cboCountries]=Null,([qryCompanyData].[CountryCode]) Like "*",[Forms]![frmCompaniesSelectionFilter]![cboCountries])
If I could I would include a wildcard in the combo box list but unfortunately the table being looked up has two fields: an auto number primary key (CountryCode) and a text field (Country).
Any ideas? %-)
GW.
"If a job's worth doing, it's worth doing twice!"