IIF and Checkboxes

  • Thread starter Thread starter Ella
  • Start date Start date
E

Ella

I’m trying to run an up date query, if the checkbox is True then un-check it.
If the checkbox is false then check it.

UPDATE tbDetails SET tbDetails.Priority =
IIf("Priority"=False,IIf("Priority"=True,False),True)
WHERE (((tbDetails.SADID)=[Forms]![frmReview]![frmReviewSub]![SADID]));

Is this possible?

Any advice appreciated
Ella
 
So you want to flip it?

UPDATE tbDetails
SET tbDetails.Priority = NOT tblDetails.Priority
WHERE ...
 
By the way, your code failed because you were testing a string to see if it
was True or False.

"Priority" = False should be
[Priority] = False

If I were using the IIF expression, I would write the query as follows.

UPDATE tbDetails
SET tbDetails.Priority = IIf([Priority]=False,True,False)
WHERE (((tbDetails.SADID)=[Forms]![frmReview]![frmReviewSub]![SADID]));

I would go with Allen Browne's version.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Thank you both!
I tried both answers and both worked well.
So I took John's advice and used Allen's suggestion.

Ella
 
Back
Top