Showing + and - in calculation

  • Thread starter evilcowstare via AccessMonster.com
  • Start date
E

evilcowstare via AccessMonster.com

Hello Everyone

I have 3 number fields, all currency in a form.
I have Budget Amount, Estimate Amount and Difference.
What I would like to do is to make the Difference work automatically, I know
you would normally do the is the control source part of the field but what I
need is for it to also display a + or - in front of the answer so for example.
..

Budget £200
Estimate £220
Difference will show +£20

Budget £400
Estimate £250
Difference will show -£150

Can anyone help as to what the code would be for this?

Thank You !!
 
J

John W. Vinson

Hello Everyone

I have 3 number fields, all currency in a form.
I have Budget Amount, Estimate Amount and Difference.
What I would like to do is to make the Difference work automatically, I know
you would normally do the is the control source part of the field but what I
need is for it to also display a + or - in front of the answer so for example.
.

Budget £200
Estimate £220
Difference will show +£20

Budget £400
Estimate £250
Difference will show -£150

Can anyone help as to what the code would be for this?

Thank You !!

Well, there may be a Format that lets you insert a leading plus - but I sure
can't find it!

I'd suggest using the IIF() function:

IIF([Estimate]<[Budget], "+", "") & Format([Estimate] - [Budget], "Currency")


John W. Vinson [MVP]
 
F

fredg

Hello Everyone

I have 3 number fields, all currency in a form.
I have Budget Amount, Estimate Amount and Difference.
What I would like to do is to make the Difference work automatically, I know
you would normally do the is the control source part of the field but what I
need is for it to also display a + or - in front of the answer so for example.
.

Budget £200
Estimate £220
Difference will show +£20

Budget £400
Estimate £250
Difference will show -£150

Can anyone help as to what the code would be for this?

Thank You !!

On the control's Format property line, write:
+ $ #;- $ #; $ 0

substituting the pound sign of course.

Look up Format property + Number and Currency datatype
in Access help.
 
J

John W. Vinson

On the control's Format property line, write:
+ $ #;- $ #; $ 0

Ahhhh.... thanks Fred, I'd forgotten the multivalue format.

John W. Vinson [MVP]
 

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