By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

Input range

P: n/a
Is there a way to setup an input mask to be a range of numbers? For
instance, only allowing 1,2,3,4 or just 1 or 2. Or should I just do a
test in the BeforeUpdate event of the control?

Thanks,
Brian

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I used a validation rule. Seemed to work ok.

Thanks,
Brian

Nov 13 '05 #2

P: n/a
BerkshireGuy wrote:
Is there a way to setup an input mask to be a range of numbers? For
instance, only allowing 1,2,3,4 or just 1 or 2. Or should I just do a
test in the BeforeUpdate event of the control?
If this is to be the case fr all values of a field, consider using the
validation rule for the approprite field in the table design window:

1 or 2 or 3 or 4

or
=1 and <=4


You can also use the validation text to explain to a user what's wrong.

To do it on the form, if you do it in the beforeupdate event (air code):

Private Sub txtMyField(Cancel As Integer)

if isnumeric(me.txtMyField.text) = false then

msgbox "Enter a number from 1 to 4!"

cancel = true

elseif me.txtMyfield.Text < 1 or _
me.txtMyfield > 4 then

msgbox "Enter a number from 1 to 4!"

cancel = true

end if

End Sub

You can probably think of neater ways to do the code above.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #3

P: n/a
Great!

Thanks Tim. Once again I should add! :)

-Brian

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.