I have bumped into the first occurrence of needing to work with user input date values in the application I am developing.
Having been warned about Access and date nonsense:
“International Dates in Access” “1. Misinterpretation in the User Interface”
I thought to find some sort of "helper control" to make date validation easier. I came across the Microsoft DateTimePicker
ActiveX control that is found in the MSCOMCT2.OCX file.
At first glance yesterday afternoon it looked bullet-proof enough. However today in further testing, cracks/limitations seem
to be appearing.
I wanted to arrive at dates in USA MM/DD/YYYY format. So I have told that control I want to use format "3" (Custom) and
filled in CustomFormat mask:
The control will not obey my two digit Month / Day request in the dates it displays in the control. As well, when I extract
the value from the control and sent it to an unbound field control, the "0" padding characters for Month / Day are
For formatting I switched to the other slash "" char in the CustomFormat field and the control updates its view to use the
other slash, however still returns the standard "/" character as the slash when reading the control's value.
So, I am thinking that all of the fancy formatting which is said to be possible with the control formats the display of the
control only, and that reading the control's value returns a more standardized date string. (But then what about my two digit
Month / Day spec?)
Finally, time keeps slipping back through the floorboard cracks. I keep whacking the time part in the Value property of the
control, and it holds that way for a little while, and then time comes right back shortly. So on its own, the Value property
is back to:
10/13/2011 9:43:52 AM
as I type this message. Clearly the time is not specified in my CustomFormat mask, and like I said the Format is set to "3"
which should mean custom, based on CustomFormat.
Suggestions on how to avoid such aggravations? Thanks!