Basically when my users enter a date into a text field I want to verify that it is in the following format:
mm/dd/yy for example
i want to make sure that I get
05/09/01
instead of
5/9/01
All suggestions appreciated in advance
Kind Regards,
Hakan
Printable View
Basically when my users enter a date into a text field I want to verify that it is in the following format:
mm/dd/yy for example
i want to make sure that I get
05/09/01
instead of
5/9/01
All suggestions appreciated in advance
Kind Regards,
Hakan
Get the individual day, month, and year and use VAL on them (will take away any leading 0's) and then add 'em back on yourself.
oh whoops
Then you can use
Format(Day_Part, "00")
Format(Year_Part, "00")
Format(Month_Part, "00")
You can use a maskeditbox and check is length...
after this you can put the text in a date to chek if it is a date (catch the error).
But this is probably not the best way to do it.
bye
Actually, you don't have the Format function in VBScript...
Still haven't figured out why that is...
Your best bet is to allow them to enter it the way they want and do validation. There is no way for you to force the format on the user.. at the end of the day, it is only a text field..
If it is that critical that the data format be a certain way, use a control that pops up a calendar and format the date yourself based on their selection.. (That's what I did)
The calendar control sounds fine... I have never worked with controls, or maybe I have and I am just not familiar with that term. Could you tell me were I could find a calender control and may be lead my in the direction on how I can adapt one to my code??
Kind Regards,
Hakan
use a datepicker.
(microsoft windows common controls-2 6.0
Is that something i have to download (ie. component or activex). And maybe an example on to setup the code, maybe a basic sniplet example would be great... anything would be great :-)
Kind Regards,
Hakan