Make positive number negitive

T

Tamm Fox

Budget is our income and sometimes this is positive. I need to make this
column in a query all negitive values.

I am using the IIf function but it is not working.

Budget: [budget_amount] IIf ([budget_amount] >=0, [budget_amount]*-1,
[budget_amount])

or is there another function I could use?
 
F

fredg

Budget is our income and sometimes this is positive. I need to make this
column in a query all negitive values.

I am using the IIf function but it is not working.

Budget: [budget_amount] IIf ([budget_amount] >=0, [budget_amount]*-1,
[budget_amount])

or is there another function I could use?

In a query?

Budget:IIf ([budget_amount] >=0, [budget_amount]*-1,
[budget_amount])

All values will be negative.
 
T

Tamm Fox

Budget is our income and sometimes this is positive. I need to make this
column in a query all negitive values.

I am using the IIf function but it is not working.

Budget: [budget_amount] IIf ([budget_amount] >=0, [budget_amount]*-1,
[budget_amount])

or is there another function I could use?

fredg said:
In a query?

Budget:IIf ([budget_amount] >=0, [budget_amount]*-1,
[budget_amount])

All values will be negative.

Fred

Thank you. Yes when i realised that i posted this in the report section, I
then posted it in the query section.

but still it does not work.

I dont know whats wrong.

I deleted what i had in the expression builder, coppied what you wrote and
pasted it directly in expression builder. for the "Field" row (and
subitiuted "budget" for "budget_amount").

ERROR: syntax error (comma) in query expression
'dbo_jobcactb.[IIf(budget_amount]>=0,[budget_amount]*-1,[budget_amount])]'.

(NOTE: "dbo_jobcactb" is the table that "Budget" comes from and the outside
[] is put in the error itself).
(NOTE: "Budget:" was just what i renamed the column from "budget_amount").

I have tried deleting the comma but still does not help.

Am i missing something somewhere?
 
T

Tamm Fox

Budget is our income and sometimes this is positive. I need to make this
column in a query all negitive values.

I am using the IIf function but it is not working.

Budget: [budget_amount] IIf ([budget_amount] >=0, [budget_amount]*-1,
[budget_amount])

or is there another function I could use?

fredg said:
In a query?

Budget:IIf ([budget_amount] >=0, [budget_amount]*-1,
[budget_amount])

All values will be negative.

Fred

Thank you. Yes when i realised that i posted this in the report section, I
then posted it in the query section.

but still it does not work.

I dont know whats wrong.

I deleted what i had in the expression builder, coppied what you wrote and
pasted it directly in expression builder. for the "Field" row (and
subitiuted "budget" for "budget_amount").

ERROR: syntax error (comma) in query expression
'dbo_jobcactb.[IIf(budget_amount]>=0,[budget_amount]*-1,[budget_amount])]'.

(NOTE: "dbo_jobcactb" is the table that "Budget" comes from and the outside
[] is put in the error itself).
(NOTE: "Budget:" was just what i renamed the column from "budget_amount").

I have tried deleting the comma but still does not help.

Am i missing something somewhere?

:

I was trying to do all the calulations within the column that the data was
in. for some reason access didnt like this.

Workaround: i created another column next to the budget column and used:
Budget_2:IIf ([budget_amount] >=0, [budget_amount]*-1, [budget_amount])
 

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