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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding numbers to fix (without decimal) 1

Status
Not open for further replies.

atiaran

Programmer
Apr 30, 2003
31
GB
I am using a Make table query to get the result of the query into a table. There are some decimal numbers in the results and although I changed the properties to be fixe (0 decimal) in the query design property, everytime I have the table the result change back to decimal. Is there anyway round it. I've got so many tables so I cannot change every table to have a fixe number

Thanks
 
Are you using the Format() to remove the decimal places in the query design??
You could use code to go through each table and change the number fields to zero decimal places or integer values.

Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
No I did not use the Format(). I just highlighted the Field in the Query design and set its properties to Fixe, 0. When I run the query as a Select Query it's fine but once it is a Make Table Query it goes back to the result with decimal number.

Could you be more specific on how to use the Format() and I dont have a clue.

Appreciate it.
Cheers
 
Try this,
In the query design grid where you specify the values for the fields give the field a name and format at the same time eg

NumNoDecPlaces: format([NumWithDecPlaces],"Fixed")

Hope it helps
 
Hi again

I used the Format() as advised but it just put the number in a 2 decimal place format.

When it was in the form of 7.71428571428571 before now it changes it to 7.71.

Any idea?

cheerssssssss
Atia
 
Change this

NumNoDecPlaces: format([NumWithDecPlaces],"Fixed")

To

NumNoDecPlaces: CLng([NumWithDecPlaces])

This will convert the number to a long integer with no decimal places and will either round up or round down as necessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top