check value in a string

N

Newbie

Hi
I have a test box that displays "ALL" when the filter is not set and a
number when it is

How do I check that what has been entered in to the text is a valid number
or "ALL"?

Thanks for any help
 
D

Dan Artuso

Hi,
How about something like:
Select Case Me.yourTextBox
Case "all"
'do something
Case "1"," 2", "3" 'this would be your valid numbers
'do something else
Case Else
'something has gone horribly wrong
End Select
 
A

Alison

Thanks - That would be ok if the valid numbers were say 1 to 10 but the user
can put any number in

Any more ideas?

Thanks
A
 
D

Dan Artuso

Hi,
Okay:

If Me.yourTextBox = "All" Or IsNumeric(Me.youtTextBox) Then
'we have a valid entry
End If
 

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

Top