Im having some problems creating a validation rule with VBA. What I have is a form with a text box. When you start to type in the text box I want to have a validation rule set so you can only type certain numbers.
The problem I am having is with this code. It works fine but for some reason I can not contiune on with more ValideRule settings except for the first line. I cant figure out what is wrong with my syntax to get it to read the next line as still part of the first line.
I have tried using (,_) (& _) (" _) and many more variations so it will read the second and third lines but no luck.
Any help would be great!
Expand|Select|Wrap|Line Numbers
- Dim strValidRule as String
- Dim strValidText as String
- strValidRule = "Between 1 And 10" Or "Between 20 And 30" _
- Or "Between 40 And 50" Or "Between 60 And 70" _
- Or "Between 80 And 90" Or "Between 100 And 110"
- strValidText = "Invalid Number."
- Text7.ValidationRule = strValidRule
- Text7.ValidationText = strValidText