combobox IIF problem

A

Andre C

Why does the following not work in the criteria field of a querry for
a combobox
IIf([Forms]![FM_Contacts1]![Active_patient], Is Not Null,Null)

In fact everytime I enter it, it is changed to
IIf([Forms]![FM_Contacts1]![Active_patient],([admitanddischarge].[dischargedate])
Is Not Null,Null)

All I want is the content of the combobox filtered on either
dischargedate has a date or is null.
 
G

Graham Mandeno

Hi Andre

You cannot use IIf to change the criteria for a query.

If I understand you correctly, one way to achieve this is to add an extra
column to your query:

Active: [Forms]![FM_Contacts1]![Active_patient]

Then use two criteria lines:

Active = 0 and dischargedate is Null

and

Active <> 0 and dischargedate is not Null

Of course, you will need to requery the combo box in your event procedures
for Form_Current and Active_patient_AfterUpdate.
 
A

Andre C

On Thu, 18 May 2006 10:42:21 +1200, "Graham Mandeno"

Many thanks. I had to slightly adapt what you suggested. I had
neglected to say that Active_patient was a radio control.

I had never appreciated using the control directly in a querry as a
field. Another learning curve jump.
 
Top