This is the code guys. The 6th column in the table is numeric.
I keep getting Error # 1004 Application-Defined or object-defined error when I try to put data into that cell.
conn.Open "DSN=foxweb;UID=;PWD=;SourceDB=c:\HRM;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
rs.Open "select * from hrdept01", conn, adOpenStatic, adLockOptimistic
iColCnt = rs.Fields().Count
iRecordCnt = rs.RecordCount
xl.Application.Visible = True
xl.Application.Workbooks.Add
xl.Application.Worksheets("Sheet1".Activate
Do Until rs.EOF
For iFor1 = 1 To iRecordCnt
For iFor2 = 1 To iColCnt
If Len(Trim(rs.Fields(iFor2 - 1).Value)) > 0 Then
xl.Cells(iFor1, iFor2) = rs.Fields(iFor2 - 1).Value
End If
Next
rs.MoveNext
Next
Loop
Could someone tell me what could/is going wrong?
Delton.
deltonphillips@hotmail.com
I keep getting Error # 1004 Application-Defined or object-defined error when I try to put data into that cell.
conn.Open "DSN=foxweb;UID=;PWD=;SourceDB=c:\HRM;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
rs.Open "select * from hrdept01", conn, adOpenStatic, adLockOptimistic
iColCnt = rs.Fields().Count
iRecordCnt = rs.RecordCount
xl.Application.Visible = True
xl.Application.Workbooks.Add
xl.Application.Worksheets("Sheet1".Activate
Do Until rs.EOF
For iFor1 = 1 To iRecordCnt
For iFor2 = 1 To iColCnt
If Len(Trim(rs.Fields(iFor2 - 1).Value)) > 0 Then
xl.Cells(iFor1, iFor2) = rs.Fields(iFor2 - 1).Value
End If
Next
rs.MoveNext
Next
Loop
Could someone tell me what could/is going wrong?
Delton.
deltonphillips@hotmail.com