Hello,
I'm very new to VBA. I've searched datepicker threads and found no answer for my problem.

I have several date fields in a user form, which for example DOB can be 80-90 years ago. The Eyre date picker is working fine in it's most basic form without options. If a user wants to change the date, the date picker is defaulting to the current month and year which for DOB is frustrating for users as you need to scroll through up to 90 years. The code below works fine if there is data in the text box ie datepicker starts at the date already in the text box, but when the text box is empty (new data entry) it causes a runtime error 13 (data type mismatch).


Private Sub imgDateDeath_Click()
Dim myDate As Date

myDate = CalendarForm.GetDate '(SelectedDate:=txtDateDeath.Value)

If myDate > 0 Then
txtDateDeath.Value = Format(myDate, "dd/mm/yyyy")
End If

End Sub


Any advice is gratefully received.