Converting negative numbers into a zero

G

Guest

I am trying to convert values in the numeric field [HW] that are negative
into zeros while keeping positive values unchanged.

when I try the expression IIf([HW]<0,0,[HW]) as a crosstab query criteria
the negative values all come out as 1, while the positive values remain
unchanged.

Does anyone know why I am getting 1 instead of 0 and what to do about it?
 
A

Allen Browne

In design view of your crosstab, what do you have in the Group By row?

Is it Count? That would make sense (counting 1 record.)
 
G

Guest

Thanks Allen

I just had Group By left there. What should it be?

Allen Browne said:
In design view of your crosstab, what do you have in the Group By row?

Is it Count? That would make sense (counting 1 record.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Dan said:
I am trying to convert values in the numeric field [HW] that are negative
into zeros while keeping positive values unchanged.

when I try the expression IIf([HW]<0,0,[HW]) as a crosstab query criteria
the negative values all come out as 1, while the positive values remain
unchanged.

Does anyone know why I am getting 1 instead of 0 and what to do about it?
 
A

Allen Browne

Switch the query to SQL View (View menu), and post the SQL statement. It
might help us to see what's going on.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Dan said:
Thanks Allen

I just had Group By left there. What should it be?

Allen Browne said:
In design view of your crosstab, what do you have in the Group By row?

Is it Count? That would make sense (counting 1 record.)

Dan said:
I am trying to convert values in the numeric field [HW] that are
negative
into zeros while keeping positive values unchanged.

when I try the expression IIf([HW]<0,0,[HW]) as a crosstab query
criteria
the negative values all come out as 1, while the positive values remain
unchanged.

Does anyone know why I am getting 1 instead of 0 and what to do about
it?
 

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