Criteria entry to call Combo box

steallan

Registered User.
Local time
Today, 01:20
Joined
Feb 9, 2005
Messages
46
Hi can anyone help please.

I have a form where users can specify crtieria for a query. The value that the user enters via a combo box on a form is entered in a query. The user then hits a button to run the query.

Problem is the entry i have in the criteria of the query that links to the form is not quite right. It work for when they enter a value but causes problems when they leave it blank. I currently have:

Like (IIf(IsNull([Forms]![Main]![CBGroup]),"*",[Forms]![Main]![CBGroup]))

CBGroup is the name of the combo box and this expression sits in the criteria of the group field.

If the user does not enter a value in the combo box i want the query to return all the records, including where the field is blank. However at the minute it only returns the records where there is any value, not the blanks as well.

The expression above works fine with Text boxes but not combos.

Sorry for the essay, thanks if you read down this far.

HELP!
 
Put this in a new column in the query grid (replacing with the correct table name):

-------------------------------------
Field: [TableName].[Group]=[Forms]![Main]![CBGroup] Or [Forms]![Main]![CBGroup] Is Null

Show: uncheck

Criteria: True
-------------------------------------
.
 
YES!

it works, hopefully it will work multiple times in the same query for different fields?

Cant work out why it works!!!??

thanks
 

Users who are viewing this thread

Back
Top Bottom