Try this as the 'criteria' in query design view, all on one line:
[Forms]![frmMyForm]![MyComboBox] Or [Forms]![frmMyForm]![MyComboBox]
="<<ALL>>"
In SQL view:
WHERE ([SomeField] = [Forms]![frmMyForm]![MyComboBox]
OR [Forms]![frmMyForm]![MyComboBox]="<<ALL>>")
If the value in the field equals the selected value in the combo box then the
first part of the OR operation in the expression will evaluate to True for
that row, so the row will be returned; if <<ALL>> is selected in the combo
box then the other part of the OR operation in the expression will evaluate
to True regardless of the value (or absence of a value) in the field, so
every row will be returned.
Note that if you set this up in query design view, and save the query, when
you open it again in design view Access will have moved things around. The
logic will be the same, however, and it will work just the same. If using
multiple 'optionalized' parameters by tacking a series of OR operations
together with ANDs. the logic is far clearer in SQL, so it makes sense to
save the query in SQL view if later amendments are contemplated.
Ken Sheridan
Stafford, England
Tom said:
Thank you.
I have tried changing the query criteria, however:
1. When I select a value in myComboBox, the query does not return any
records. (They are there)
It is possible to massage the WHERE clause of the query so that it
evaluates to True for all records if the combo's value is "<<ALL>>".
[quoted text clipped - 21 lines]
source data tables?
Thanks in advance.
--
.