Hi
I have a Calendar Form called frmLab_Daily_Calendar and the Calendar control is named ocxDaily_Calendar.
I use this procedure to open a form based on the users selection of a particular date.
There may be more steps than I need but it works well for my purposes.
Create an unboud text box on your calendar form. Call it txtDaily_Date and set its visible property to No.
Add these codes to the AfterUpdate and Click events for your Calendar Control.
Private Sub ocxDaily_Calendar_AfterUpdate()
txtDaily_Date.Value = Format(ocxDaily_Calendar.Object.Value, "ddddd")
End Sub
Private Sub ocxDaily_Calendar_Click()
On Error GoTo Err_ocxDaily_Calendar_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmLab_Daily"
stLinkCriteria = "#" & Me![txtDaily_Date] & "#"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria
DoCmd.Maximize
Exit_ocxDaily_Calendar_Click:
Exit Sub
Err_ocxDaily_Calendar_Click:
Resume Exit_ocxDaily_Calendar_Click
End Sub
If you wish to view the form in Normal view change the acFormsDS to acNormal.
I then have a query that the frmLab_Daily is based on. In the Criteria row of the Date field for that query enter this.
[Forms]![frmLab_Daily_Calendar]![txtDaily_Date]
Hope this helps you out.
Any questions you can email me.
D.J.
[This message has been edited by DJBummy (edited 08-19-2001).]
[This message has been edited by DJBummy (edited 08-19-2001).]