Hi,
I am trying to use the calender form that I found in the Samples section. I really like the functionality but am struggling to make it work as a sub form rather than a stand alone form.
When the calender form loads, the event below is activated. Can some one please show me how to change it so that it work when the calender form is a subform. In my case, I am trying to use this form on a main form called Prospects. A module is also ran, but I guess the method will be the same for both for referencing. The first place it falls down is Set f = Forms!frmCalendar. I did think I could just use Set f = Forms!Prospect!frmCalendar but it does not work.
I am trying to use the calender form that I found in the Samples section. I really like the functionality but am struggling to make it work as a sub form rather than a stand alone form.
When the calender form loads, the event below is activated. Can some one please show me how to change it so that it work when the calender form is a subform. In my case, I am trying to use this form on a main form called Prospects. A module is also ran, but I guess the method will be the same for both for referencing. The first place it falls down is Set f = Forms!frmCalendar. I did think I could just use Set f = Forms!Prospect!frmCalendar but it does not work.
Code:
Private Sub Form_Load()
Dim i As Integer, j As Integer
Dim mycontrol As Control
Dim strYear As String, nextYear As String
Dim f As Form
Dim mynum
Set f = Forms!frmCalendar
For i = 1 To 37
Forms!frmCalendar!("Text" & i).Visible = False
Forms!frmCalendar!("Day" & i).Visible = False
Next
'Set mycontrol = Me.Year
j = 1990
strYear = j
For i = 1 To 60
nextYear = j + i
strYear = strYear & ";" & nextYear
'Me.Year.AddItem j + i
Next i
Me.year.RowSource = strYear
Me!month = Format(Now, "m")
Me!year = Format(Now, "yyyy")
Call Cal([month], [year])
End Sub