Good Day,

I've created a report and now I need to sort the datasource (an access database) so that the report only shows data for a certain month and year. here is my code.

VB Code:
  1. Private Sub DataReport_Initialize()
  2. Dim rmonth As String
  3. Dim ryear As String
  4.  
  5. rmonth = RptStart.List1.Index = "0"
  6. rmonth = RptStart.List1.Index = "0"
  7.  
  8. DataEnvironment1.Recordsets = "select * from giveway where month = rmonth and year = ryear order by name"
  9.  
  10. End Sub

I get an error that says invalid use of property. Can anyone help?

Thank you