Positive Integers Only

  • Thread starter Thread starter ExcessAccess
  • Start date Start date
E

ExcessAccess

I have a make-table query. One of the fields that this
query makes is called "Quantity." It's a calculated field
that creates a number. I only want positive integers. As
of now, I get numbers like 6489.498 or -210. How can I
make it so that all negative numbers become "0"? How can
I also make it so that I only get whole numbers, with no
numbers to the right of the decimal?

Thanks much in advance.

~J
 
Use a calculated expression like:
NewField: IIf([expression]<0,0,Int([expression]))
 
When I use your suggested expression in the criteria for
the calclated field, it changes the total number of
records showing up after running the query (make-table).
Can you tell me why this is happening?

~J

-----Original Message-----
Use a calculated expression like:
NewField: IIf([expression]<0,0,Int([expression]))


--
Duane Hookom
MS Access MVP


ExcessAccess said:
I have a make-table query. One of the fields that this
query makes is called "Quantity." It's a calculated field
that creates a number. I only want positive integers. As
of now, I get numbers like 6489.498 or -210. How can I
make it so that all negative numbers become "0"? How can
I also make it so that I only get whole numbers, with no
numbers to the right of the decimal?

Thanks much in advance.

~J


.
 
I didn't expect you to place anything in the criteria. This is the "Field"
expression in the first line of the query grid.

--
Duane Hookom
MS Access MVP


ExcessAccess said:
When I use your suggested expression in the criteria for
the calclated field, it changes the total number of
records showing up after running the query (make-table).
Can you tell me why this is happening?

~J

-----Original Message-----
Use a calculated expression like:
NewField: IIf([expression]<0,0,Int([expression]))


--
Duane Hookom
MS Access MVP


ExcessAccess said:
I have a make-table query. One of the fields that this
query makes is called "Quantity." It's a calculated field
that creates a number. I only want positive integers. As
of now, I get numbers like 6489.498 or -210. How can I
make it so that all negative numbers become "0"? How can
I also make it so that I only get whole numbers, with no
numbers to the right of the decimal?

Thanks much in advance.

~J


.
 
Back
Top