Use combobox from form in query

bodylojohn

Registered User.
Local time
Today, 09:55
Joined
Dec 28, 2005
Messages
205
Hello,

I have a form containing a combobox with the values yes (1) and no (2).

In my query I have a date field. When the value of the combo is yes only the dates should be displayed. is the value no the the empty fields should be shown. I nothing is selected all fields should be displayed.

I tried this:

Code:
IIf(IsNull([Forms]![Form1]![cboDate]);
IIf([Forms]![Form1]![cboDate]=1;[tblITEM]![date_ID] is not null; is null);[tblITEM]![date_ID])

But without success.
 
In my query I have a date field. When the value of the combo is yes only the dates should be displayed. is the value no the the empty fields should be shown. I nothing is selected all fields should be displayed.

Try this criteria in a NEW column in the query grid in query Design View:-

-------------------------------------------
Field: IIf([Forms]![Form1]![cboDate]=1; [tblITEM]![date_ID] is not null; IIf([Forms]![Form1]![cboDate]=2; [tblITEM]![date_ID] is null; True))

Show: uncheck

Criteria: True
-------------------------------------------

Note:
It's assumed that your version of Access uses ; rather than , as function argument separator and that [tblITEM]![date_ID] is the date field that you mentioned.
.
 

Users who are viewing this thread

Back
Top Bottom