Hey everyone, I am stuck on this whole ADO thing. We never used it in class and now I have to use it in my final project. I have the entire project done, except for the last little part, which I can't figure out.
Code:
Public Function ADO_ListBooksPublishedYear(yearPublished As Integer)
Dim rst As ADODB.Recordset
Dim strSQL As String
strSQL = "Select datepart('yyyy', pubdate) as bookYear from tblBooks"
Set rst = New ADODB.Recordset
rst.Open strSQL, CurrentProject.Connection, adOpenStatic, adLockReadOnly, adCmdText
MsgBox "There are " & rst.RecordCount & "records in the unfiltered Recordset"
rst.Filter = "bookYear = yearPublished"
MsgBox "There are " & rst.RecordCount & "records in the filtered Recordset"
End Function
This is what I have so far. I can't get the filter to work right either. It won't allow me to use the yearPublished variable in the filter. Also I am supposed to display the results from the Recordset after filtering in the immediate window.
I'm not looking for someone to do this for me, just to steer me in the right direction. I have been searching google for a while trying to figure this out. Would really appreciate any help.