Validation Rule

D

Dan

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"
 
M

MacDermott

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.
 
D

Dan

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
 
A

Allen Browne

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.
 
M

MacDermott

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"
 
Top