IsNumber() not available for Validation Rules

I'm trying to validate that characters 2 through 5 of a table's text field should be numeric. However, IsNumeric() doesn't seem to be available (Access 2003).
LVL 1
MilewskpAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Dale FyeConnect With a Mentor Commented:
try:

Validation Rule: Like "?[0-9][0-9][0-9][0-9][0-9]*"

0
 
Michael VasilevskySolutions ArchitectCommented:
IsNumeric should work in VBA and in a SQL statement. What do you mean it doesn't seem to be available? What are some strings you're trying to validate?

MV
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
VBA:

If IsNumeric(Mid(sFldText, 2, 4)) Then
   ' what ever

Query:

SELECT IsNumeric(Mid([FIELD1],2,4)) AS Expr1
FROM Table1;

or

SELECT IIf(IsNumeric(Mid([FIELD1],2,4)),"Yes","No") AS Expr1
FROM Table1;

mx
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
Dale FyeCommented:

Or you could use something like:

SELECT * FROM yourTable WHERE [yourField] not like "?[0-9][0-9][0-9[0-9][0-9]*"

This will identify all records where the first character allows any character, then the next 5 characters are numeric, and then has any number of other characters.  The NOT will identify any records that violate this rule.

I'm not certain whether this is available in the Validation, but could be used in the BeforeUpdate event to test the value in the control.
0
 
MilewskpAuthor Commented:
I should have been more clear: I was trying to use IsNumeric() in the Validation Rule property of a table's text field. It didn't work, and when I clicked Build, I discovered that IsNumeric is not included in the list of built-in functions. Therefore I assume it's not avaialble for validation rule properties (even though it may be avaiable in VBA and SQL).
0
 
MilewskpAuthor Commented:
Thanks fyed, you're a genius.
0
 
Dale FyeCommented:
Glad to help,

I generally prefer to put my validation tests in the Form_BeforeUpdate
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.