I have downloaded and copied the relevant files into my dbase from
This works on normal forms but not when the subform is trying to get it to work it does not
I am not very familar with how class work but from what I do now you can call a control and use it. The error message I get (generated by the class module) is that "I must instantiate the class object before calling the function"
Intructions state
Option Compare Database
Option Explicit
' This declares the MonthCalendar Class
Private mc As clsMonthCal
Private Sub Form_Load()
' Create an instance of our Class
Set mc = New clsMonthCal
' Set the hWndForm Property
mc.hWndForm = Me.hWnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
' This is required in case user Closes Form with the
' Calendar still open. It also handles when the
' user closes the application with the Calendar still open.
If Not mc Is Nothing Then
If mc.IsCalendar Then
Cancel = 1
Exit Sub
End If
Set mc = Nothing
End If
End Sub
Private Sub txtSelectDate_DblClick(Cancel As Integer)
Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date
dtStart = Nz(Me.txtSelectDate.Value, 0)
dtEnd = 0
blRet = ShowMonthCalendar(mc, dtStart, dtEnd)
If blRet = True Then
Me.txtSelectDate = dtStart
Else
' Add any message here if you want to
' inform the user that no date was selected
End If
End Sub
This works on normal forms but not when the subform is trying to get it to work it does not
I am not very familar with how class work but from what I do now you can call a control and use it. The error message I get (generated by the class module) is that "I must instantiate the class object before calling the function"
Intructions state
Option Compare Database
Option Explicit
' This declares the MonthCalendar Class
Private mc As clsMonthCal
Private Sub Form_Load()
' Create an instance of our Class
Set mc = New clsMonthCal
' Set the hWndForm Property
mc.hWndForm = Me.hWnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
' This is required in case user Closes Form with the
' Calendar still open. It also handles when the
' user closes the application with the Calendar still open.
If Not mc Is Nothing Then
If mc.IsCalendar Then
Cancel = 1
Exit Sub
End If
Set mc = Nothing
End If
End Sub
Private Sub txtSelectDate_DblClick(Cancel As Integer)
Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date
dtStart = Nz(Me.txtSelectDate.Value, 0)
dtEnd = 0
blRet = ShowMonthCalendar(mc, dtStart, dtEnd)
If blRet = True Then
Me.txtSelectDate = dtStart
Else
' Add any message here if you want to
' inform the user that no date was selected
End If
End Sub