Hi Jeffry,
You mentioned using a macro. Are you using the OutputTo action? This is indeed limited to 16 K
rows, even in current versions of Excel. Try using the TransferSpreadsheet action instead. I use
macros as little as possible, but here is a sample VBA procedure that I use for a QBF (Query by
Form) form, to export records displayed in a subform. Perhaps this will be useful to you. Watch
for word wrap. I removed some indenting, in an effort to minimize any word wrap issues.
Private Sub cmdExportToExcel_Click()
On Error GoTo ProcError
Dim strPath As String
Dim lngRecordCount As Long
Const conFileName As String = "UnitData.xls"
lngRecordCount = Me.subQueryByForm.Form.Recordset.RecordCount
strPath = CurrentProject.Path
'Limit is 65536, but you need to reserve one row for the column
' headings if HasFieldNames = true.
If lngRecordCount > 65535 Then
MsgBox "There are too many records to export." & vbCrLf _
& "The maximum limit is 65,535 records.", vbCritical, "Too Many Records..."
Else
DoCmd.TransferSpreadsheet TransferType:=acExport, TableName:="qryQBF", _
FileName:=strPath & "\" & conFileName, HasFieldNames:=True
MsgBox "The selected data has been exported to the file " & conFileName & vbCrLf _
& "in the folder:" & vbCrLf & strPath, vbInformation, "Export Complete..."
End If
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in cmdExportToExcel_Click event procedure..."
Resume ExitProc
End Sub
Tom Wickerath
Microsoft Access MVP
____________________________________________________
Arvin,
I think you might be right, I am running excell 97.
could you explain a bit more on how to write 2 or more queries to divide and
export the data.
Regards
Jeffry
____________________________________________________