access if then statement

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

hi,

i need help. i have to write an if/then statement in
access and it's for my query1 - the statement is to be
written in the - advance_amount field - and i want it to
look at tran_code field - and all 600 numbers i want to be
converted to a negative number and any 700 numbers into a
positive number except 745 which will remain as is. can
someone please help?

thanks
mike
 
Try:
=IIF(tran_code=745,745,iif(and
(tran_code>=600,tran_code<700),-abs(tran_code),iif(and
(tran_code>=700,tran_code<800),abs(tran_code),tran_code)))

The last phrase accounts for the possibility of tran_code
being outside the 600-799 range - it just leaves it alone.

Hope this does what you want it to do.
 
thanks! i love this community group.
-----Original Message-----
Try:
=IIF(tran_code=745,745,iif(and
(tran_code>=600,tran_code<700),-abs(tran_code),iif(and
(tran_code>=700,tran_code<800),abs(tran_code),tran_code)))

The last phrase accounts for the possibility of tran_code
being outside the 600-799 range - it just leaves it alone.

Hope this does what you want it to do.

.
 
Back
Top