473,396 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Input range

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
3 2060
I used a validation rule. Seemed to work ok.

Thanks,
Brian

Nov 13 '05 #2
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
Great!

Thanks Tim. Once again I should add! :)

-Brian

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: EAS | last post by:
How do you make a loop where the program keeps asking for an integer or float until it gets one? (No letters or other input.)
29
by: Enrico `Trippo' Porreca | last post by:
Both K&R book and Steve Summit's tutorial define a getline() function correctly testing the return value of getchar() against EOF. I know that getchar() returns EOF or the character value cast to...
1
by: Grey | last post by:
I have created a asp.net form for user to input data. After input the data, user need to click a button to export the input data to excel for data analysis with excel pivot table function. is it...
2
by: Yolande | last post by:
Hi there, I have a C# web service and I want to specify the lower bound and upper bound of input value. e.g. public long MilesToKilometers(long lngMiles). I want the input value for lngMiles...
17
by: Martin Jørgensen | last post by:
Hi, Since I'm a newbie I have some small but quick (probably) stupid questions also :-) This is my "get_double" function which takes a default argument also of type double. The function...
10
by: ¬a\\/b | last post by:
Careful thought library functions are important i think that for tame (domare) the input stream are useful function like these i use. i don't know if they are right Note: when ask input: is...
3
by: marknoten | last post by:
I'm quite a newbie to Visual Basic and have a problem with the Input # statement in the Visual Basic Editor from Excel. I would like to read in a tab delimeted text file selected by a user with...
1
by: Will_uk | last post by:
I am trying to return focus to a form input field. If i use <form>.<field>.focus() the focus returns to the field but if the field already contains a value it selects it (blacks it out). Is it...
4
by: blues7709 | last post by:
Does anyone know how to do advanced input box functions? I am trying to use 1 input box to capture the users requests for several ID numbers. I then take these ID's and compare them to an Excel...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.