|
-
May 11th, 2001, 01:58 PM
#1
Thread Starter
Member
How do I force a format on a txt field
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
-
May 11th, 2001, 03:00 PM
#2
Good Ol' Platypus
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.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 11th, 2001, 03:02 PM
#3
Good Ol' Platypus
oh whoops
Then you can use
Format(Day_Part, "00")
Format(Year_Part, "00")
Format(Month_Part, "00")
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 11th, 2001, 03:02 PM
#4
Junior Member
You will be able to find a better way, but...
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
-
May 11th, 2001, 03:56 PM
#5
Frenzied Member
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)
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
May 14th, 2001, 08:23 AM
#6
Thread Starter
Member
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
-
May 14th, 2001, 09:24 AM
#7
Junior Member
datepicker
use a datepicker.
(microsoft windows common controls-2 6.0
-
May 14th, 2001, 10:22 AM
#8
Thread Starter
Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|