Help with IIF statement

hockeyadc

Registered User.
Local time
Today, 06:02
Joined
Sep 6, 2011
Messages
20
So I have an IIF statement that I ran and it outputs the data the way I want it to. The only thing I dont know how to do is how do I take the data/results I get from running the query and put it into a specific column in a table?
 
You don't. Use the query instead.
 
Theres no way to do it? Basically I want to look data in column1 of a table, and if it says "Yes" then column2 I want to say "1". Theres no way to code this?
 
You need to create an update query based on your table, bring down the field you want to update (Column 2) and the column you are using as your criteria (Column 1). In the 'Update To' section beneath Column 2 put in 1, leave the 'Update To' section beneath Column 1 blank. In the criteria section beneath Column 1 put "Yes" and leave the criteria section beneath Column 2 blank.

As with any action query, make a backup of the table you are working with just in case things don't go as planned.
 
Actually I have another question about it.. I ran the update for one criteria and that worked find, but what if I have another? Say I want the "No" to output a 2 on column 2 as well? Can I do both in one query?
 
Yes you can. Create an update query based on your table, bring down the field you want to update (Column 2) and the column you are using as your criteria (Column 1). In the 'Update To' section beneath Column 2 put in this:

IIf([Column 1]="YES", 1, 2)



Leave the 'Update To' section beneath Column 1 blank. In the criteria section beneath Column 1 put this:

"Yes" OR "No"

Leave the criteria section beneath Column 2 blank.
 

Users who are viewing this thread

Back
Top Bottom