Victor
03-24-2009, 08:45 AM
Hi all:
According to Mr. Martin Green's site and quote "Each date field combo box ( CboStartDate and CboStartDate2) can call the same calendar control, but the calendar needs to know which combo called it so that it can return a date to the correct one", thats why I have 2 CboSartDate, and CboStartDate2 combo box name.
Both combo box called the same calendar control (ocxcalendar) even They have different names.
Any idea what I am doing wrong?
Thanks for the help.
Victor
Option Compare Database
Option Explicit
Dim CboOriginator As ComboBox
Private Sub CboStartDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ocxcalendar.Visible = True
ocxcalendar.SetFocus
If Not IsNull(CboStartDate) Then
ocxcalendar.Value = CboStartDate.Value
Else
ocxcalendar.Value = Date
End If
End Sub
Private Sub CboStandartDate2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ocxcalendar.Visible = True
ocxcalendar.SetFocus
If Not IsNull(CboStartDate) Then
ocxcalendar.Value = CboStartDate.Value
Else
ocxcalendar.Value = Date
End If
End Sub
Private Sub ocxcalendar_Click()
Set CboOriginator = CboStartDate
CboStartDate.Value = ocxcalendar.Value
CboStartDate.SetFocus
ocxcalendar.Visible = False
Set CboOriginator = Nothing
End Sub
According to Mr. Martin Green's site and quote "Each date field combo box ( CboStartDate and CboStartDate2) can call the same calendar control, but the calendar needs to know which combo called it so that it can return a date to the correct one", thats why I have 2 CboSartDate, and CboStartDate2 combo box name.
Both combo box called the same calendar control (ocxcalendar) even They have different names.
Any idea what I am doing wrong?
Thanks for the help.
Victor
Option Compare Database
Option Explicit
Dim CboOriginator As ComboBox
Private Sub CboStartDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ocxcalendar.Visible = True
ocxcalendar.SetFocus
If Not IsNull(CboStartDate) Then
ocxcalendar.Value = CboStartDate.Value
Else
ocxcalendar.Value = Date
End If
End Sub
Private Sub CboStandartDate2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
ocxcalendar.Visible = True
ocxcalendar.SetFocus
If Not IsNull(CboStartDate) Then
ocxcalendar.Value = CboStartDate.Value
Else
ocxcalendar.Value = Date
End If
End Sub
Private Sub ocxcalendar_Click()
Set CboOriginator = CboStartDate
CboStartDate.Value = ocxcalendar.Value
CboStartDate.SetFocus
ocxcalendar.Visible = False
Set CboOriginator = Nothing
End Sub