Validation Rule

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there anywya to have a validation rule that specifies that the value in
the tex box of a type string is either an integer or equal to "Unlimited"
 
You can write code in your control's BeforeUpdate event procedure to check
this, but it would be hard to do just as a ValidationRule.
 
I'm sure that you can do it other ways but how would you do the line: ElseIf
[text1] = Integer portion of the following if-statement:

If [text1] = "Unlimited" Then
.....
ElseIf [text1] = Integer Then
Else: Throw Error
End If
 
Dan, it would make more sense to me to use a Number field, and display the
word "Unlimited" on a report for Null.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Dan said:
I'm sure that you can do it other ways but how would you do the line:
ElseIf
[text1] = Integer portion of the following if-statement:

If [text1] = "Unlimited" Then
....
ElseIf [text1] = Integer Then
Else: Throw Error
End If

MacDermott said:
You can write code in your control's BeforeUpdate event procedure to
check
this, but it would be hard to do just as a ValidationRule.
 
I like Allen's suggestion, but if your users require otherwise, you could
use IsNumeric to determine whether the entry is a number, and either InStr
with a "." or Int([text1])=[text1] to determine whether it's an integer. Be
sure you do the IsNumeric test first, though, or Int could throw an error if
it's a string.


Dan said:
I'm sure that you can do it other ways but how would you do the line: ElseIf
[text1] = Integer portion of the following if-statement:

If [text1] = "Unlimited" Then
....
ElseIf [text1] = Integer Then
Else: Throw Error
End If

MacDermott said:
You can write code in your control's BeforeUpdate event procedure to check
this, but it would be hard to do just as a ValidationRule.

"Unlimited"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top