Help!
I found some coding where I can include a pop-up calendar on my Access Forms for date fields. I have several forms that I would like to use this code to update one date or multiple dates depending on the form but I am having a problem where on some of the forms, the coding works wonderful, but on others, ugh!!!!!
for multiple dates ---
the coding I am using is the following:
change date field to a combo box
insert calendar using:
Calendar Control 8.0
visible = No
properties on date field -
on mouse down:
Option Compare Database
Dim cboOriginator As ComboBox
-----------------------------------------------------------
Private Sub Daily_date_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Note which combo box called the calendar
Set cboOriginator = Daily_date
' Unhide the calendar and give it the focus
ocxCalendar.Visible = True
ocxCalendar.SetFocus
' Match calendar date to existing date if present or today's date
If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub
------------------------------------------------------
Private Sub ocxCalendar_Click()
' Copy chosen date from calendar to originating combo box
cboOriginator.Value = ocxCalendar.Value
' Return the focus to the combo box and hide the calendar and
cboOriginator.SetFocus
ocxCalendar.Visible = False
' Empty the variable
Set cboOriginator = Nothing
End Sub
this form the coding works fine.
I use the same format for another form, but it doesn't work correctly. When I choose the date, it displays a small box with JULY and locks the form.
Any suggestions would be greatly appreciated............
I found some coding where I can include a pop-up calendar on my Access Forms for date fields. I have several forms that I would like to use this code to update one date or multiple dates depending on the form but I am having a problem where on some of the forms, the coding works wonderful, but on others, ugh!!!!!
for multiple dates ---
the coding I am using is the following:
change date field to a combo box
insert calendar using:
Calendar Control 8.0
visible = No
properties on date field -
on mouse down:
Option Compare Database
Dim cboOriginator As ComboBox
-----------------------------------------------------------
Private Sub Daily_date_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Note which combo box called the calendar
Set cboOriginator = Daily_date
' Unhide the calendar and give it the focus
ocxCalendar.Visible = True
ocxCalendar.SetFocus
' Match calendar date to existing date if present or today's date
If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub
------------------------------------------------------
Private Sub ocxCalendar_Click()
' Copy chosen date from calendar to originating combo box
cboOriginator.Value = ocxCalendar.Value
' Return the focus to the combo box and hide the calendar and
cboOriginator.SetFocus
ocxCalendar.Visible = False
' Empty the variable
Set cboOriginator = Nothing
End Sub
this form the coding works fine.
I use the same format for another form, but it doesn't work correctly. When I choose the date, it displays a small box with JULY and locks the form.
Any suggestions would be greatly appreciated............