General information
Category:
Coding, syntax & commands
Hmmm...
The first problem is interpreting what year the user is intending. If you can always assume the current year then you can do something like this.
You textbox (or two textboxes) need(s) to return an error for months outside of 1-12 and days outsides of 1-31. Once you do that, convert the char data into a date. Someting like
ldMikeDate = ctod(alltrim(str(year(date())))+"/"+lcMonth+"/"+lcDay)
A blank date will be returned from CTOD if the date is not valid (such as Feb 31/99). You could then give the user an error.
You would want to put some thought into the function that you use to ensure you don't introduces a y2k bug or a bug that incorrectly assumes the year the user intends.
If it were up to me I would do one of the following:
- get the user to enter the year
- display the full date after you have done the error checking to ensure the user knows what year the program has interpreted it as.
>I need a textbox control that allows entry of just month and day, No year. I do need the validation used for good dates (i.e. 2/29 only in a leap year). I can create a custom control using a ##/## picture and do all my own error checking, but would just as soon avoid this if possible.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only