Data Report Error: operation is not allowed when object is closed
Posted on 2010-09-14
I am trying to populate a data report in vb6 by using an ADO recordset as the data source. I have the following text boxes on the report:
I get an error(operation is not allowed when object is closed) when the code below:
Dim rsTickets As New ADODB.Recordset
Dim dtStart As Date, dtEnd As Date
dtStart = dtpFrom.Value & " 00:00:00 AM"
dtEnd = dtpTo.Value & " 11:59:59 PM"
strSQL = "SELECT * FROM Tiko WHERE [T_Date] BETWEEN #"
strSQL = strSQL & dtStart & "# AND #"
strSQL = strSQL & dtEnd & "# ORDER BY T_Date"
Set .DataSource = rsTickets
.DataMember = rsTickets.DataMember
What is the proper sysntax for this or where am i going wrong?