?
Solved

IsNumber() not available for Validation Rules

Posted on 2011-09-20
7
Medium Priority
?
580 Views
Last Modified: 2013-11-29
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).
0
Comment
Question by:Milewskp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 10

Expert Comment

by:Michael Vasilevsky
ID: 36569960
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
 
LVL 75
ID: 36570185
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
 
LVL 48

Expert Comment

by:Dale Fye
ID: 36570937

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Milewskp
ID: 36573507
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
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 36573547
try:

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

0
 
LVL 1

Author Comment

by:Milewskp
ID: 36574267
Thanks fyed, you're a genius.
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 36574283
Glad to help,

I generally prefer to put my validation tests in the Form_BeforeUpdate
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question