Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation on Control

Status
Not open for further replies.

bethabernathy

Programmer
Jul 13, 2001
254
MX
Hi - I am trying to get the syntax to make a calculation on a control in a report.

I am trying to calculate this:

If a product sale is "RFND" then the product amount is negative currency, if the product sale is anything other than "RFND" the product amount is positive currency.

So this is where I am at:

IIf([passstat]="RFND", [pmt_amt]=*-1, [pmt_amt])

But I am getting a syntax error with this. Is this possible to do?

Thanks, Beth
 
I'm pretty sure it doesn't like the =*-1 (three operators in succession). You need to state WHAT you are multiplying by -1.
Try this:
IIf([passstat]="RFND", [pmt_amt]=[pmt_amt]*(-1), [pmt_amt])
 
Hi RegionsRob-

That sounds good, but I am still getting a syntax error - Comma related. Any other ideas.

Thanks SOOOOOOOOOOOOOOOOOOOOO much.

Beth
 
Hmmm, I'm stumped with the comma error. It could be that Access is being stupid -- you can try putting ( ) around the THEN clause and see if it smartens up.
IIf([passstat]="RFND", ([pmt_amt]=[pmt_amt]*(-1)), [pmt_amt])
 
Beth,

You can't perform an assignment with the IIf function. You were closer with your first post. Take out the equal sign in the true part. Try:
Code:
IIf([passstat]="RFND", [pmt_amt]*-1, [pmt_amt])
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top