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

Rounding to 500 or 1000!!! 1

Status
Not open for further replies.

Fekri

Programmer
Jan 3, 2004
284
IR
Hi to all,

I have a calculation result on my form and I want to create a button command to make the result Round to 500 or 1000.

for example:

result Round

1350 1500
1780 2000
340 500
910 1000

any one can help me?

thanks
Ali

Thanks & Good Luck
Ali Fekri
 
G'day Ali

I've assumed your control are called txtIn and txtOut:

Code:
Private Sub BtnRndTo500_Click()

   Dim intResult As Integer

   intResult = CInt(Me!txtIn / 500)

   Me!txtOut = intResult * 500

End Sub

Hope that helps, works perfectly with your examples.

JB
 
Thanks so much

it was so perfect.



Thanks & Good Luck
Ali Fekri
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top