Re: Determine if input is a decimal
From: Ken Snell [MVP] (kthsneisllis9_at_ncoomcastt.renaetl)
Date: 12/13/04
- Next message: Ken Snell [MVP]: "Re: Code ain't pretty"
- Previous message: Ken Snell [MVP]: "Re: SetFocus question"
- In reply to: Fred Boer: "Determine if input is a decimal"
- Next in thread: Fred Boer: "Re: Determine if input is a decimal"
- Reply: Fred Boer: "Re: Determine if input is a decimal"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 13 Dec 2004 13:36:05 -0500
If Me.ControlName.Value <> CLng(Me.ControlName.Value) Then
MsgBox "You must enter a whole number!"
End If
Note that this will work so long as the number is within the data size
limits of a Long data type. If the number will be larger than those limits,
then you may need to use InStr to search for embedded decimal point.
--
Ken Snell
<MS ACCESS MVP>
"Fred Boer" <Fredboer1@NOyahooSPAM.com> wrote in message
news:%23nJJvzT4EHA.2196@TK2MSFTNGP14.phx.gbl...
> Hello!
>
> I have a student creating a form. He wants to use an AfterUpdate event to
do
> data validation. He wants only whole numbers, no decimals. He wants help
> with this and expects I know how to do this.... I said *of course* I
could,
> but that I had no time just then... ;)
>
> I suppose I might try doing something like searching for a period using
> InStr() or something, but perhaps there is a more elegant "math" function
or
> some kind of "math" thing that can determine if a number has decimals?
>
> Note: When you read "math", invest it with all the fear, loathing,
> bewilderment and consternation you can - that's the way I say it! ;)
>
> Thanks!
> Fred Boer
>
>
- Next message: Ken Snell [MVP]: "Re: Code ain't pretty"
- Previous message: Ken Snell [MVP]: "Re: SetFocus question"
- In reply to: Fred Boer: "Determine if input is a decimal"
- Next in thread: Fred Boer: "Re: Determine if input is a decimal"
- Reply: Fred Boer: "Re: Determine if input is a decimal"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|