hey there,
here is my code that i use to export to excel.
i know that it steps through each cell to paste the header values and then pastes the entire recordset for the dataset.
what is the best way to alter the code to ensure it does not break if the recorset is null?
thanks
tuk
here is my code that i use to export to excel.
i know that it steps through each cell to paste the header values and then pastes the entire recordset for the dataset.
what is the best way to alter the code to ensure it does not break if the recorset is null?
thanks
tuk
Code:
Set rst = dbs.OpenRecordset(strExport, dbOpenDynaset, dbReadOnly)
If rst.EOF = False And rst.BOF = False Then
rst.MoveFirst
If blnHeaderRow = True Then
For lngColumn = 0 To rst.Fields.Count - 1
xlc.Offset(0, lngColumn).Value = rst.Fields(lngColumn).Name
Next lngColumn
Set xlc = xlc.Offset(1, 0)
End If
xlc.CopyFromRecordset rst
End If