MajP
You've got your good things, and you've got mine.
- Local time
- Yesterday, 22:58
- Joined
- May 21, 2018
- Messages
- 8,555
OK here it is. Give it a try. There are a few formatting issues, but seems to work. Now that this is built it would be easy to do a year view or six month view.
A calendar control should do 2 things only.
1. Return a date when the value changes
2. Allow you to display a selected date.
It does the first one by having an event that you can trap. It does the second by exposing a method to allow you to set the date.
Here is the code to use the control
A calendar control should do 2 things only.
1. Return a date when the value changes
2. Allow you to display a selected date.
It does the first one by having an event that you can trap. It does the second by exposing a method to allow you to set the date.
Here is the code to use the control
Code:
Option Compare Database
Option Explicit
'Defing a MonthCal as below
Private WithEvents MonthCal As Form_3MonthCalendar
'On load set month cal to the subform
Private Sub Form_Load()
Set MonthCal = Me.subFrm3month.Form
End Sub
'You can now trap the calendar change event
Private Sub MonthCal_DateChange(TheDate As Date)
Me.fldDate = TheDate
End Sub
'You can set the value of the calendar
Private Sub fldDate_AfterUpdate()
MonthCal.SelectedDate = fldDate
End Sub
Private Sub fldDate_Change()
If IsDate(fldDate.Text) Then
Me.Dirty = False
MonthCal.SelectedDate = fldDate
End If
End Sub
Private Sub Form_Current()
MonthCal.SelectedDate = Nz(Me.fldDate, Date)
End Sub
Last edited: