T
Theo
Can't get this to work. This is Leban's code. I get an error message on this
******* "Compile error. User defined type not defined.
OK - I've clearly missed a step, but I can't tell where.
I am a newbie! Any suggestions?
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 EventDate_DblClick(Cancel As Integer)
Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date
dtStart = Nz(Me.EventDate.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
End Sub
******* "Compile error. User defined type not defined.
OK - I've clearly missed a step, but I can't tell where.
I am a newbie! Any suggestions?
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 EventDate_DblClick(Cancel As Integer)
Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date
dtStart = Nz(Me.EventDate.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
End Sub