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

Round to the nearest hundreds place 2

Status
Not open for further replies.

cramd

Programmer
Mar 28, 2001
214
US
Variable caccumtotal = $637362.20

process vb statement--
caccumtotal = Round(rst("glpa13"), 0)

now caccumtotal = $637362 BUT I need it to round to the nearest hundreds place. Result should be $637400. What am I missing? Any thoughts would be appreciated.

Diane
 
Would this help?

caccumtotal = Round(rst("glpa13") / 100, 0) * 100

 
well, without digging through MS's instrinsic functions, you could simply calculate the hundreths value yourself, then round accordingly. such as:

Code:
lngYourNumber = 45677

intRounder = lngYourNumber Mod 100  'the hundreths value

If intRounder >= 50 Then
   ' add the difference of 100 - the remainder
   lngYourNumber = lngYourNumber + (100 - intRounder)
Else
   ' subrtract the remainder
   lngYourNumber = lngYourNumber - intRounder
End If
 
Thank you both for the suggestions. Exactly what I needed!!
Diane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top