IIF Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to creating Access queries.
I would like to change the Amount to -ve/+ve number if its a Credit/Dedit.
For example:
If DR_CR is C then Trans Amount should be formated as negative number.

How do I do this? should it be a expression, a code?
Should I create this in query or report?

Please help.
Thank you
Pon
 
I am new to creating Access queries.
I would like to change the Amount to -ve/+ve number if its a Credit/Dedit.
For example:
If DR_CR is C then Trans Amount should be formated as negative number.

How do I do this? should it be a expression, a code?
Should I create this in query or report?

Please help.
Thank you
Pon

In a query....
NewValue:IIf([DR_CR]= "C",[TransAmount]*-1,[TransAmount])

Use the NewValue field in your report.

Directly in a Report.... (using an Unbound text control) ....
= IIf([DR_CR]= "C",[TransAmount]*-1,[TransAmount])
 
Thank you very much.
My query and report both worked with the help of your IIF statement.
Pon.

fredg said:
I am new to creating Access queries.
I would like to change the Amount to -ve/+ve number if its a Credit/Dedit.
For example:
If DR_CR is C then Trans Amount should be formated as negative number.

How do I do this? should it be a expression, a code?
Should I create this in query or report?

Please help.
Thank you
Pon

In a query....
NewValue:IIf([DR_CR]= "C",[TransAmount]*-1,[TransAmount])

Use the NewValue field in your report.

Directly in a Report.... (using an Unbound text control) ....
= IIf([DR_CR]= "C",[TransAmount]*-1,[TransAmount])
 
Back
Top