Click to See Complete Forum and Search --> : Failed getting Rowset(s) from current data source


Lood Fick
October 11th, 2001, 06:20 AM
Here is my code.

It displays the first time i run it but the second time it gives me an error called 'Failed getting Rowset(s) from current data source'.

I have put some code in the datareport's terminate event.

Please help.

(Private Sub DataReport_Terminate()
DE.rsTransactions.Close
DE.Connection.Close
End Sub)

(Private Sub Print_Click()
Dim Sql As String
Dim DateFrom As String, DateTo As String



ReOpenDatabase
If DE.Connection.State = adStateOpen Then
DE.Connection.Close
End If

Sql = ""
DateFrom = ""
DateTo = ""


Sql = DE.Commands("Transactions").CommandText

DateFrom = dtFrom.Year & "/" & dtFrom.Month & "/" & dtFrom.Day
DateTo = dtTo.Year & "/" & dtTo.Month & "/" & dtTo.Day

Sql = Sql & " and Tran_Date>=#" & DateFrom & "# and Tran_Date<=#" & DateTo & "#"

If cboSelectName.ListIndex <> -1 Then
Sql = Sql & " and Card_Transactions.Card_Number='" & cboSelectName.ItemData(cboSelectName.ListIndex) & "'"
End If

If cboDoor.ListIndex <> -1 Then
Sql = Sql & " and Devices.Controller_ID=" & cboDoor.ItemData(cboDoor.ListIndex)
End If


Debug.Print Sql
DE.Commands("Transactions").CommandText = Sql
Transaction.Show vbModal, Me


Sql = ""

End Sub)

Punc ***