Append table with If then else

M

MN

Hi- I want ot append a data from tbl1 to tbl2 with:
If tbl1.fld1=1 or 2 or 3 then append to tbl2.fld1=1
else
if tbl1.fld1=0 then append to tbl2.fld1=00
How can I do it in query Append? Thanks-NM
 
E

Evi

Your only problem is the choice of 1 or 00 in the target field. That seems
to be more a case of formatting the target that what you append (which
should be 1 or 0) unless you are implying that the target field is a Text
field.

Assuming it isn't:
In your query, have a calculated field eg

Matches: IIF(((Field1=1) OR (field1=2) OR (Field1 = 3)) <>0,1,IIF(Field1 =
0,0,whatever you want to do if it equals something other than 1,2,3or 0))

You also don't say if tbl1.fld1 can be anything other than 1,2,3 or 0 so I'm
assuming it can otherwise the function can be simply

Matches: ((Field1=1) OR (field1=2) OR (Field1 = 3))*-1


and append the results

Evi
 
M

MN

Thank you :)

Evi said:
Your only problem is the choice of 1 or 00 in the target field. That seems
to be more a case of formatting the target that what you append (which
should be 1 or 0) unless you are implying that the target field is a Text
field.

Assuming it isn't:
In your query, have a calculated field eg

Matches: IIF(((Field1=1) OR (field1=2) OR (Field1 = 3)) <>0,1,IIF(Field1 =
0,0,whatever you want to do if it equals something other than 1,2,3or 0))

You also don't say if tbl1.fld1 can be anything other than 1,2,3 or 0 so I'm
assuming it can otherwise the function can be simply

Matches: ((Field1=1) OR (field1=2) OR (Field1 = 3))*-1


and append the results

Evi
 

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