Hi all,
can anyone assist on this one (I'm newbie to VBA)
I'm trying to get the list of items from mySql (I have a successful connection)
for some reason I get this error message:
Run-time error '9':
Subscript out of range.
thanks for any pointers!
Private Sub btnTestReadInMysqlData_Click()
Dim objDB, arrRecord, strRecord, strOutput
Dim oRS, nRec, oFld
Dim row
'Database connection & select all from Table
Set objDB = DBConnect()
Set oRS = objDB.Execute("SELECT * FROM `production` WHERE id<1000000")
'Dump Records from Table
nRec = 0
row = 1
Do While Not oRS.EOF
For Each oFld In oRS.Fields
'WScript.Echo oFld.Name & " = " & oFld.Value
Worksheets("Tabelle1").Cells(row, 1).Value = oFld.Value
'increment
row = row + 1
Next
oRS.MoveNext
Loop
End Sub
Function DBConnect()
Set objDB = CreateObject("ADODB.Connection")
objDB.Open "ago_usgroups"
Set DBConnect = objDB
End Function