Hi there,
I was wondering if anyone can help me?
I have an excel sheet which reads data from an oracle db using odbc.
The data is retrieved successfully - and I can see all the rows and columns in the recordset as the data is displayed in the Immediate window just fine.
However, I am having a real tough time setting the values of cells to the recordset data.
So far, I have managed to successfully retrieve and display the data in the Immediate Window, but when I try writing the results to the excel sheet, all 200+ rows instead of filling downwards in the sheet, cyle through row 1 (columns A,B andC).
-any help would be greatly appreciated!
The code below shows my attempt to fill the retrieved data downwards in the excel sheet:
Dim x As Range
Set x = ActiveCell.CurrentRegion
col1 = x.Columns(1).Column
lastCol = col1 + x.Columns.Count - 1
row1 = x.Rows(1).Row
lastRow = row1 + x.Rows.Count - 1
Do While Not rst.EOF
For r = row1 To lastRow Step 1
Set rec = rst("APPCD"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set rec2 = rst("ENG"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set rec3 = rst("FR"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Cells(r, 1).Value = rec
If rec2 = 0 Then
Cells(r, 2).Value = 0
End If
If rec3 = 0 Then
Cells(r, 3).Value = 0
End If
Debug.Print rec & ", " & rec2 & ", " & rec3
Next r
rst.MoveNext
Loop
Set get_ivr_records = rst
End Function
I was wondering if anyone can help me?
I have an excel sheet which reads data from an oracle db using odbc.
The data is retrieved successfully - and I can see all the rows and columns in the recordset as the data is displayed in the Immediate window just fine.
However, I am having a real tough time setting the values of cells to the recordset data.
So far, I have managed to successfully retrieve and display the data in the Immediate Window, but when I try writing the results to the excel sheet, all 200+ rows instead of filling downwards in the sheet, cyle through row 1 (columns A,B andC).
-any help would be greatly appreciated!
The code below shows my attempt to fill the retrieved data downwards in the excel sheet:
Dim x As Range
Set x = ActiveCell.CurrentRegion
col1 = x.Columns(1).Column
lastCol = col1 + x.Columns.Count - 1
row1 = x.Rows(1).Row
lastRow = row1 + x.Rows.Count - 1
Do While Not rst.EOF
For r = row1 To lastRow Step 1
Set rec = rst("APPCD"
Set rec2 = rst("ENG"
Set rec3 = rst("FR"
Cells(r, 1).Value = rec
If rec2 = 0 Then
Cells(r, 2).Value = 0
End If
If rec3 = 0 Then
Cells(r, 3).Value = 0
End If
Debug.Print rec & ", " & rec2 & ", " & rec3
Next r
rst.MoveNext
Loop
Set get_ivr_records = rst
End Function