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

Rounding - How 1

Status
Not open for further replies.

wally2321

Technical User
May 30, 2001
64
0
0
US
Can some one help me please? I am creating a query using the design feature. The problem is the number I am loading has 8 digits past the decimal whereas I only want two places. The second digit past the decimal should be rounded up or down, depending on the number.

Is there a good way to do that in MS Access
 
rightclick on the field you want rounded. this will pop up a menu. click on properties set your format to fixed and decimal places to 2
good luck
 
If you really want to "trim" off the excess decimal places, use this:

Function RoundCC(X)
RoundCC = Int(X * Factor + 0.5) / Factor
End Function

Use it like MyNumber = RoundCC(MyNumber)

 
KJC,

You forgot to mention that he'll need to place:

Const Factor = 100

in the module so that Factor is a known number. To change the number of decimal places, modify the factor. IE:

3 decimals, Const Factor = 1000
4 decimals, Const Factor = 10000

etc...

HTH Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top