Hi, I have been writing vba scripts for a few months now and the biggest headache I have come across, time after time, is how to validate a date input on a form. Nothing seems to work very well and I have tried lots of different suggestions from trawling through the 'net. There seems to be two main methods of formatting the date once it is input: CDate(Me.MyDate.Value) and FormatDateTime(Cells(r,c),vbShortDate). Which one is best and what is the difference between them?
When validating a dd/mm/yy date using IsDate(MyDate.Value), this ignores any date where the user has input dots instead of slashes and will also accept any input such as "1.234.45". I have tried Not MyDate.Value Like "##[/]##[/]####" which then forces me to input every character of the date i.e 01/03/2011.
Can someone please give me a definitive answer to the date input and validation issue? Many thanks.
When validating a dd/mm/yy date using IsDate(MyDate.Value), this ignores any date where the user has input dots instead of slashes and will also accept any input such as "1.234.45". I have tried Not MyDate.Value Like "##[/]##[/]####" which then forces me to input every character of the date i.e 01/03/2011.
Can someone please give me a definitive answer to the date input and validation issue? Many thanks.