Using Calender (Input2000) As A Sub Form

diannosd

Registered User.
Local time
Today, 06:17
Joined
Feb 14, 2008
Messages
11
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.



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
 
On RE reading your post, I believe you are using a calendar form composed of separate individual controls on a form. In that case most of my comments are irrelevant.

However I would suggest that you consider using the calendar control provided by Microsoft.

Hi thanks for taking the time to reply but I do feel a little lost. I am happy with the calender control that I am using (got from here). I just wanted a way where when i clicked on a button on my main form, it would open for example a sub form which looks like a magnified calender to show for each day any diary events like a schedule. The Input2000 sample seems perfect except its created as a main stand-alone form rather than a subform. Like I say the first bits it falls down on is Set f = Forms!frmCalendar. I tried to change this to something like Set f = Forms!frmProspects!frmCalendar but it does not work. Is this what you meant about not compatible??
 

Users who are viewing this thread

Back
Top Bottom