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!

Validate number as integer 1

Status
Not open for further replies.

FurryGorilla

Technical User
Apr 11, 2001
76
GB
Hi all

I've got a little problem on a datasheet which involves putting the length or quantity (depending on the category) into a textbox on form in datasheet view. I was going to use an if statement and then use the mod function but found any value mod 1 returns 0 even if it's a decimal value:

20.5 MOD 1 = 0 (this should surely be 0.5)
20.0 MOD 1 = 0

Is there any other way of validating this ina differen way.

Many thanks
Chris ____________________________
Have you seen my munkee? [monkey]
 
Hi Chris

You could always use the INT function, and then compare that to the original value.

Int(20.5) = 20 but in this case int(control) would not be equal to control
Int(20.0) = 20 but in this case int(control) would be equal to control

An alternative is to set the number of decimal paces in the properties of the control, depending on whether you are expecting a quantity or a length.

Hope this helps

Tom
 
Cheers Tom.

That's exactly what I need. Thanks. ____________________________
Have you seen my munkee? [monkey]
 
A way often used by early programmers is the following.

If int(X)/X less than a verey small number - we used 1E6


rollie@bwsys.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top