SQL

  • Thread starter Thread starter mrs
  • Start date Start date
M

mrs

I have a form with some controls on it including a
checkbox. I want to know how to change the WHERE clause
depending if the checkbox is checked or not.

Here is my WHERE:

WHERE (((tblEvents.ProductID)=[forms]![frmStrtDtStrBy]!
[cmbProductName]) AND ((tblEvents.CompletedByDate)=IIf
([Forms]![frmStrtDtStrBy]![Check78]="Yes",Not Null,Null)))
ORDER BY tblEvents.StartDate, tblEvents.AssignedToID;


I am using the IIF expression. I verified all of form
namse and they are corrrect. Any ideas on how to do this?

Thanks,

mrs
 
TRY the following.

WHERE ...
AND (tblEvents.CompletedByDate IS Null <> [Forms]![frmStrtDtStrBy]![Check78])


If that fails try using the VBA IsNull Function.

AND IsNull(tblEvents.CompletedByDate) <> [Forms]![frmStrtDtStrBy]![Check78])

The Access query grid will add a new calculated field in both cases and then put
the
<> [Forms]![frmStrtDtStrBy]![Check78]
in the criteria cell under the calculated field.
 
Thanks!!!
-----Original Message-----
TRY the following.

WHERE ...
AND (tblEvents.CompletedByDate IS Null <> [Forms]! [frmStrtDtStrBy]![Check78])


If that fails try using the VBA IsNull Function.

AND IsNull(tblEvents.CompletedByDate) <> [Forms]! [frmStrtDtStrBy]![Check78])

The Access query grid will add a new calculated field in both cases and then put
the
<> [Forms]![frmStrtDtStrBy]![Check78]
in the criteria cell under the calculated field.

I have a form with some controls on it including a
checkbox. I want to know how to change the WHERE clause
depending if the checkbox is checked or not.

Here is my WHERE:

WHERE (((tblEvents.ProductID)=[forms]![frmStrtDtStrBy]!
[cmbProductName]) AND ((tblEvents.CompletedByDate)=IIf
([Forms]![frmStrtDtStrBy]![Check78]="Yes",Not Null,Null)))
ORDER BY tblEvents.StartDate, tblEvents.AssignedToID;

I am using the IIF expression. I verified all of form
namse and they are corrrect. Any ideas on how to do this?

Thanks,

mrs
.
 
Back
Top