Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With API Calendar

Status
Not open for further replies.

thefox149

Technical User
Nov 22, 2004
158
AU
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
 
Try:

Private mc As New clsMonthCal

Instead of:

Private mc As clsMonthCal


Whether you are calling this class from a form or subform should be irrelevant. The only thing it is concerned about is the hWnd of the form it is called from (Me.hWnd)

Cheers,
Bill
 
the new part sealed it thanks formerTexan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top