PC Review


Reply
Thread Tools Rate Thread

How to determine if an entry is a character or number

 
 
DontKnow
Guest
Posts: n/a
 
      18th Feb 2010
hi Guys,

I need a way to determine if an single entry is a character or is a number...

Please helpme!!

Cheers
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      18th Feb 2010
On Thu, 18 Feb 2010 15:28:01 -0800, DontKnow
<(E-Mail Removed)> wrote:

>hi Guys,
>
>I need a way to determine if an single entry is a character or is a number...
>
>Please helpme!!
>
>Cheers


Well, a number *is* a character...

The IsNumeric() function will return TRUE if its string argument is a valid
number: e.g. IsNumeric("345") is True, IsNumeric("a45") is false.

There's a tricky little "gotcha" though: if the argument is a valid number in
the old, old Fortran Floating Point notation, such as "31E5" or "2D30"
(corresponding to 31 * 10^5 or 2 * 10^30) it will be true, though you might
consider these to be text.
--

John W. Vinson [MVP]
 
Reply With Quote
 
Marshall Barton
Guest
Posts: n/a
 
      19th Feb 2010
DontKnow wrote:
>I need a way to determine if an single entry is a character or is a number...



If Me.textbox Like "[a-z]" Then
' it's a letter
ElseIf Me.textbox Like "[0-9]" Then
' it's a number
Else
' it's something else
End If

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
DontKnow
Guest
Posts: n/a
 
      19th Feb 2010

Thnaks mate!!

Thats exactly what I want, I'll do a string search for the rogue "D" or "E"
using the "instr" function


Many thnaks again!!

cheers,
"John W. Vinson" wrote:

> On Thu, 18 Feb 2010 15:28:01 -0800, DontKnow
> <(E-Mail Removed)> wrote:
>
> >hi Guys,
> >
> >I need a way to determine if an single entry is a character or is a number...
> >
> >Please helpme!!
> >
> >Cheers

>
> Well, a number *is* a character...
>
> The IsNumeric() function will return TRUE if its string argument is a valid
> number: e.g. IsNumeric("345") is True, IsNumeric("a45") is false.
>
> There's a tricky little "gotcha" though: if the argument is a valid number in
> the old, old Fortran Floating Point notation, such as "31E5" or "2D30"
> (corresponding to 31 * 10^5 or 2 * 10^30) it will be true, though you might
> consider these to be text.
> --
>
> John W. Vinson [MVP]
> .
>

 
Reply With Quote
 
Marshall Barton
Guest
Posts: n/a
 
      19th Feb 2010
Alternatively:

If Me.textbox Like "*[!0-9]*" Then
' text box contains a non-decimal digit
Else
' text box contains only decimal digits
End If

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BeforeUpdate to determine length of entry and allow or not the entry Ohi Microsoft Access Form Coding 0 22nd Jun 2011 08:11 PM
Determine if an input key is a number, letter or special character moondaddy Microsoft C# .NET 3 4th Nov 2009 02:39 PM
Determine last character typed Tim J La Fazia Microsoft Access Form Coding 2 25th Feb 2007 01:58 AM
RE: How to determine the value of a printable character? =?Utf-8?B?Qm9iIFVtbGFzLCBFeGNlbCBNVlA=?= Microsoft Excel Misc 0 13th Feb 2006 08:39 PM
How do I determine if a Char is in some character set? Isaac Chen Microsoft Dot NET Framework 0 26th Aug 2003 08:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:49 PM.