I have a form with the Calendar 9.0 control on it. I want to use it to filter the records on the subform. I haven't found an easy way to do this. I've setup the code below in the Update event of the calendar but when I change the date on the calendar nothing happens. Please help.
Private Sub ocxCalendar_Updated(Code As Integer)
Dim dtm As Date
Dim str As String
dtm = Me!ocxCalendar.Value
str = "SELECT tblMain.txtID, tblMain.txtEmployee, tblMain.txtType, "
str = str & "tblMain.txtPTOTime, tblMain.txtNote, tblMain.txtDate "
str = str & "FROM tblMain WHERE (((tblMain.txtDate)=#" & dtm & "#));"
Me!sfrmDetails.Form.RecordSource = str
End Sub
Private Sub ocxCalendar_Updated(Code As Integer)
Dim dtm As Date
Dim str As String
dtm = Me!ocxCalendar.Value
str = "SELECT tblMain.txtID, tblMain.txtEmployee, tblMain.txtType, "
str = str & "tblMain.txtPTOTime, tblMain.txtNote, tblMain.txtDate "
str = str & "FROM tblMain WHERE (((tblMain.txtDate)=#" & dtm & "#));"
Me!sfrmDetails.Form.RecordSource = str
End Sub