Hi,
I am trying to put the data from the table tblPB_>_0_Crosstab_Counts and from the field 30 Days, and it just keeps running in a continues loop. If I hold the cursor over the connection it shows the right connection, but if I hold it over the Rs..EOF it say “ Operation is not allowed when object is closed”.; but it should be open. That is is a couple of lines above it is opened. Als, I used this exact same code in another program , I mean natually different fields and tables, but it works thaer just fine. And I have all the references set. So I do not know what is going on here. Any ideas would be much appreciated. Thank you
This is what I have.
Dim Rs As ADODB.Recordset
Dim Cn As Connection
Dim xl1 As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim r1 As Excel.Range
Set Cn = New ADODB.Connection
Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data SOURCE = J:\APPSUPT\Adv_EscRPT\VB2\P188.mdb;"
'Cn.ConnectionTimeout = 30
Cn.Open
Set xl1 = CreateObject("Excel.Application")
Set xlBook = xl1.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
Set xlSheet = xlBook.Worksheets(2)
Set xlSheet = xlBook.Worksheets(3)
FileName3 = "J:\APPSUPT\Adv_EscRPT\VB2\P188.XLS"
xl1.Workbooks.Open (FileName3)
xl1.Visible = True
Set Rs = New ADODB.Recordset
Rs.Open ("Select [30 Days] FROM tblPB_>_0_Crosstab_Counts"), _
Cn, adOpenKeyset, adLockOptimistic
x = 66
y = 9
Rs.Open
Do Until (Rs.EOF)
Set r1 = xl1.Range((Chr$(x) & Val))
r1 = Rs![30 Days]
'x = x + 1
y = y + 1
Rs.MoveNext
Loop
ITM
I am trying to put the data from the table tblPB_>_0_Crosstab_Counts and from the field 30 Days, and it just keeps running in a continues loop. If I hold the cursor over the connection it shows the right connection, but if I hold it over the Rs..EOF it say “ Operation is not allowed when object is closed”.; but it should be open. That is is a couple of lines above it is opened. Als, I used this exact same code in another program , I mean natually different fields and tables, but it works thaer just fine. And I have all the references set. So I do not know what is going on here. Any ideas would be much appreciated. Thank you
This is what I have.
Dim Rs As ADODB.Recordset
Dim Cn As Connection
Dim xl1 As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim r1 As Excel.Range
Set Cn = New ADODB.Connection
Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data SOURCE = J:\APPSUPT\Adv_EscRPT\VB2\P188.mdb;"
'Cn.ConnectionTimeout = 30
Cn.Open
Set xl1 = CreateObject("Excel.Application")
Set xlBook = xl1.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
Set xlSheet = xlBook.Worksheets(2)
Set xlSheet = xlBook.Worksheets(3)
FileName3 = "J:\APPSUPT\Adv_EscRPT\VB2\P188.XLS"
xl1.Workbooks.Open (FileName3)
xl1.Visible = True
Set Rs = New ADODB.Recordset
Rs.Open ("Select [30 Days] FROM tblPB_>_0_Crosstab_Counts"), _
Cn, adOpenKeyset, adLockOptimistic
x = 66
y = 9
Rs.Open
Do Until (Rs.EOF)
Set r1 = xl1.Range((Chr$(x) & Val))
r1 = Rs![30 Days]
'x = x + 1
y = y + 1
Rs.MoveNext
Loop
ITM