Hi, what I'm trying to accomplish is to pump data from an Access query into an Excel spreadsheet by using a Get Row array. The array works but because my query only shows results in one row with many columns, it's filling in the cells with only the data of the first column in the first record. Could anyone be kind enough to tell me what I'm doing wrong?
Private Sub IntoExcel()
Set objXLBook = GetObject(Application.CurrentProject.Path & "\Excel.xls"
Set objXLApp = objXLBook.Parent
Set objResultsSheet = objXLBook.Worksheets("Results"
objXLApp.Visible = True
objXLBook.Windows(1).Visible = True
Set objRec = New ADODB.Recordset
objRec.Open "qryTotalAccounts", CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
varResults = objRec.GetRows()
objRec.Close
Set objXLRange = objResultsSheet.Range("Results"
objXLBook.Save
Set objRec = Nothing
Set objCmd = Nothing
Set objXLApp = Nothing
Set objXLBook = Nothing
Set objResultsSheet = Nothing
Set objXLRange = Nothing
End Sub
Private Sub IntoExcel()
Set objXLBook = GetObject(Application.CurrentProject.Path & "\Excel.xls"
Set objXLApp = objXLBook.Parent
Set objResultsSheet = objXLBook.Worksheets("Results"
objXLApp.Visible = True
objXLBook.Windows(1).Visible = True
Set objRec = New ADODB.Recordset
objRec.Open "qryTotalAccounts", CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
varResults = objRec.GetRows()
objRec.Close
Set objXLRange = objResultsSheet.Range("Results"
objXLBook.Save
Set objRec = Nothing
Set objCmd = Nothing
Set objXLApp = Nothing
Set objXLBook = Nothing
Set objResultsSheet = Nothing
Set objXLRange = Nothing
End Sub