Versions 2007 and later have a DatePicker that, by default, will automatically appear when a Field defined as Date/Time is entered.
You can actually have the calendar 'pop up' when the Control has Focus, rather than requiring that the user click on the icon to pop the calendar up, with code like
Code:
Private Sub DateField_GotFocus()
DoCmd.RunCommand acCmdShowDatePicker
End Sub
To have it only pop up, on Focus, if the Textbox is empty:
Code:
Private Sub DateField_GotFocus()
If Nz(Me.DateField,"") = "" Then
DoCmd.RunCommand acCmdShowDatePicker
End If
End Sub
And while it doesn't have a Property Pane, using the DatePicker is treated as if the data were physically entered, which means that you can attach actions to the usual Events of the Control, such as its BeforeUpdate and AfterUpdate events.
You could, for example, insure that any date entered is not in the past, and if this rule is violated, pop a warning message to the user, Cancel the Field update, and pop up the DatePicker once again, ready for a correct date to be entered:
Code:
Private Sub DateField_BeforeUpdate(Cancel As Integer)
If Me.DateField < Date Then
MsgBox "Invalid Date!"
Cancel = True
DoCmd.RunCommand acCmdShowDatePicker
End If
End Sub
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007