IIf Statement In an Update Query

C

CSmalley

I am very new at this and am having problems with an update query IIF
statement. I need to clear the data from my Cycle field if the parameter
date equals the record date on the table. Not even sure if this is possible.

Example:
Field: Cycle
Update to: IIf([DATE]=[enter date],Null)

But everytime I run it clears the cycle field of all records in the table.

Thanks for any help..
 
C

CSmalley

That worked perfectly!.. Thanks so much!
--
C.Smalley


tkelley via AccessMonster.com said:
You're missing an argument. You need a truepart and a falsepart. I'm
surprised this even lets you run it. Maybe it's assuming null for the
falsepart too.

Try this: IIf([DATE]=[enter date],Null,[Enter Date])
I am very new at this and am having problems with an update query IIF
statement. I need to clear the data from my Cycle field if the parameter
date equals the record date on the table. Not even sure if this is possible.

Example:
Field: Cycle
Update to: IIf([DATE]=[enter date],Null)

But everytime I run it clears the cycle field of all records in the table.

Thanks for any help..
 
F

fredg

That worked perfectly!.. Thanks so much!

That's great. Just be advised that Date is a reserved Access keyword
and should not be used as a field name.

For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'

For an even more complete list of reserved words, see:
http://www.allenbrowne.com/AppIssueBadWord.html
 
C

Clifford Bass

Hello,

You did not include any other parts of your update statement. If that
is the only field you are updating, you probably should use this:

update [tblSomeTable]
set [Cycle] = Null
where [DATE] = [enter date];

Since you say you are very new to this, here is some additional
information. To see and/or edit the SQL statement of your queries you can
click on the down arrow next to the left-most button in the tool bar that you
use to switch back and forth between data sheet view and design, and then
choose SQL View. If you put the above SQL into a new query's SQL, replacing
anything already there and fixing the table name, you should see how it would
look in designer mode by switching to design view.

Clifford Bass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top