Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format input data

Status
Not open for further replies.

DickEp

Programmer
Sep 5, 2001
26
0
0
US
I want to set up a user form with input of date format. Is there a way in VBA that I can have the format set up and the user just has to put in the numbers?

In other words, if I have the box with the '/' in it for the month/day/year, all they have to enter is the month number, day number, and year number. Possible???

Thanks
 
Why not use 3 separate text boxes then join them together at the end.
 
How can I get the data to automaticall jump to the next box without the user tabbing?

I am trying to make this as easy as possible for someone to put in data.
 
I suppose you could put a line in the change event along the lines of 'if len(DateString) = 2 then jump to next box' But I think leaving the user to TAB is better as it allows them to correct mistakes.
 
forcing ANY user to use a TAB to move to the next field is totally contrary to good performance of input data!!.

A good input application will only require the "enter" key to jump to the next field.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
There is a fundamental logical problem here. The use MUST do SOMETHING to diffrentiate where the month ends and the day begins.

Suppose the user enters 12304. Is that 1/23/04 or is it 12/3/04? Having pre-loaded slashes doesn't help all that much.

I only see 2 ways to go. Have the user always enter 6 digits in a single field, i.e. 012304 or 120304 or allow the user to use a decimal point as the delimiter (and handle the resulting string in code) so he can enter 1.23.04 or 12.3.04 -- I use the decimal point because it is right there along with the numbers on the keypad.

If you are clever, you can intercept the keystrokes and whenever the user presses the "." key replace the result with "/" -- This is what I actually do in production applications that have date input. (I allow either "." or "/" as a date delimiter along with "-")
 
It is pretty standard Windows functionality to use TAB to go between fields. If you disable this, most windows application users would wonder why the TAB key wasn't working! You could program the Enter Key and the TAB key to have the same functionality. Using a full stop is the same as using the '/' , I thought the object of the exercise was to make the user not have to type anything but the numbers.
 
I would suggest that you use the Date Picker

it will set out input as you require
and
allow Picking of a date

and Eliminate most of your "validation of users input" problems


Peter Wallace
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top