Change Calender Code So That It Works As A Subform

S

SEAN DI''''ANNO

Hi,

I am trying to a calender form that I found which shows diary events
happening on days of the month. It is designed to work as a stand alone form
but I am trying to use it as a subform.

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.


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top