Text values (1 Viewer)

k209310

Registered User.
Local time
Today, 08:27
Joined
Aug 14, 2002
Messages
185
Hello

I have written a function that allows a "/" to be entered automatically in to a text box at the required point. The format of teh text box is set to "Short Date"

If I type the date in by hand eg "12/12/2003" then i get no problems however if i set the function so that thee "/" is entered automatically an error message occurs telling me that the value i have entered is not valid for the field.

If i set the format to nothing then i get no problems however i need the format to be set to a date for other reasons.

Has anybody got any ideas about this

Cheers

Chris
 

dcx693

Registered User.
Local time
Today, 03:27
Joined
Apr 30, 2003
Messages
3,265
Did you try using an input mask to have Access enter the "/" characters for you?
 

k209310

Registered User.
Local time
Today, 08:27
Joined
Aug 14, 2002
Messages
185
dcx693

That would obviously be much easier.

Thanks
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:27
Joined
Feb 19, 2002
Messages
43,686
I can't figure out what the objective of the "/" function is or when it would run. If your objective is to save keystrokes, you're better off having people type the slash. Your method requires the user to type high order zeros for all the one digit months and one digit days. By typing the slash, the user just types 6/9 and Access translates that as June 9, 2003. You have to type many more characters when using a mask and the mask still can't edit the data. It only makes sure the entry is numeric. Besides, most people don't want to type 01 for January. They want to type only a 1. I find the input mask annoying because it requires the user to type a 4 digit year. I prefer to let the user type no year or a two digit year if year is not the current year. The date field should be set to always show the 4 digit year so the user is aware of the assigned value.
 

Users who are viewing this thread

Top Bottom