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

Code to add a field on equalling a value

Status
Not open for further replies.

knighty03

Technical User
Aug 12, 2003
32
GB
I want to obtain code whereby if the quantity field is not a whole number e.g. 2.4, 4.8, etc. then it will round up the number to the next highest whole number e.g. 2.1 would become 3. I would be grateful if anyone can help.
 
Code:
Function RoundUp(ByVal varNumber As Variant) As Variant
  If IsNumeric(varNumber) Then
    If varNumber = Int(varNumber) Then
      RoundUp = Int(varNumber)
    Else
      RoundUp = Int(varNumber) + 1
    End If
  End If
End Function


VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
You can put this expression directly in the query on the Field line.

MyRoundedField:-1 * Int(-1*[NumberField])

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top