I have a form with a Start_Date and End_Date. When either get the Focus I want the calendar to appear. Once a date is selected disappear. I would like to reuse this item in all my projects and understand that passing the originator is important. Also have read that making the calendar appear and disappear after a date is selected may be a problem if the calendar defaults to Date() and the user is trying to select today.
Option Compare Database
Option Explicit
Dim Calendar_Originator As ComboBox ‘Tells who started the Calender
Private Sub Start_Date_Combo_GotFocus()
Calendar.Visible = True
Calendar.SetFocus
If Not IsNull(Start_Date_Combo) Then
Calendar.Value = Start_Date_Combo.Value
Else
Calendar.Value = Date
End If
End Sub
Private Sub Calendar_Click()
Start_Date_Combo.Value = Calendar.Value
Stop_Date_Combo.SetFocus ‘ Having problems with what to set the focus on
Calendar.Visible = False
Set Calendar_Originator = Nothing
End Sub
Thanks
Option Compare Database
Option Explicit
Dim Calendar_Originator As ComboBox ‘Tells who started the Calender
Private Sub Start_Date_Combo_GotFocus()
Calendar.Visible = True
Calendar.SetFocus
If Not IsNull(Start_Date_Combo) Then
Calendar.Value = Start_Date_Combo.Value
Else
Calendar.Value = Date
End If
End Sub
Private Sub Calendar_Click()
Start_Date_Combo.Value = Calendar.Value
Stop_Date_Combo.SetFocus ‘ Having problems with what to set the focus on
Calendar.Visible = False
Set Calendar_Originator = Nothing
End Sub
Thanks