Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,612
- Office Version
- 365
- 2016
- Platform
- Windows
I have a userform for which the user enters a date as "mmddyy" into a textbox (tbx_date). A function then validates the entry as being a valid date.
With a valid user entry (ie date), I run the following code intended to replace the value of tbx_date with a value formatted as "dd-mmm-yyyy".
mbevents = False 'suspends triggers for value updating
tbx_date.Value = dd & "-" & mtxt & "-" & Format(yy, "yyyy")
mbevents = True
...[/code]
A user entering a valid entry of 071004 (July 10 2004) results with an improper value of tbx_date as 10-Jul-1900.
What must I do to correct this so that the year is represented as 2004?
With a valid user entry (ie date), I run the following code intended to replace the value of tbx_date with a value formatted as "dd-mmm-yyyy".
Code:
...
idate = tbx_date.Value
mm = CInt(Left(idate, 2))
mtxt = MonthName(mm, True)
dd = CInt(Mid(idate, 3, 2))
yy = CInt(Right(idate, 2))
tbx_date.Value = dd & "-" & mtxt & "-" & Format(yy, "yyyy")
mbevents = True
...[/code]
A user entering a valid entry of 071004 (July 10 2004) results with an improper value of tbx_date as 10-Jul-1900.
What must I do to correct this so that the year is represented as 2004?