Help with IIF statement (1 Viewer)

hockeyadc

Registered User.
Local time
Yesterday, 17:11
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?
 

plog

Banishment Pending
Local time
Yesterday, 19:11
Joined
May 11, 2011
Messages
11,646
You don't. Use the query instead.
 

hockeyadc

Registered User.
Local time
Yesterday, 17:11
Joined
Sep 6, 2011
Messages
20
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?
 

plog

Banishment Pending
Local time
Yesterday, 19:11
Joined
May 11, 2011
Messages
11,646
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.
 

hockeyadc

Registered User.
Local time
Yesterday, 17:11
Joined
Sep 6, 2011
Messages
20
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?
 

plog

Banishment Pending
Local time
Yesterday, 19:11
Joined
May 11, 2011
Messages
11,646
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

Top Bottom