p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   Outputto exceeded limit of rows (http://p2p.wrox.com/showthread.php?t=39008)

Renee Voice February 25th, 2006 01:05 AM

Outputto exceeded limit of rows
I have used the docmd.outputto command to export a query into Excel and have got the error message which states that the limit of Access or the OutputTo command has been exceeded. Does anyone know what the limit is and how to overcome it. There are 21095 rows to be exported. Here is a sample of the code:

Set qdfNew = CurrentDb.CreateQueryDef("NewQueryDef", _
                "SELECT * FROM [Adviser Flows - Holdings] WHERE [DbaseMngr] like '" & strFundMngr & "*'" _
                & "union all SELECT * FROM [ADVISER FLOWS - HOLDINGS Essentials Funds] WHERE [DbaseMngr] like '" & strFundMngr & "*'")
          'If there are records for the Fund Manager the data is exported into the Excel file
          If DCount("[DbaseMngr]", "NewQueryDef") <> 0 Then
                        StatusBar "The " & strFileNme & " is being created...."
            DoCmd.OutputTo acOutputQuery, "NewQueryDef", acFormatXLS, strPth & strFileNme

I would really appreciate any help you can give me.


Bob Bedell February 26th, 2006 12:14 PM

Hi Renee,

Have you tried TransferSpreadsheet yet? I don't know what the limit of either function is (probably buried in some ancient document archive on MSDN). The two other options would be Excel Automation or the ADO connection string extended property "Extended Properties=""Excel 8.0""", both of which are touched on a bit on the other topic you posted to. Here's a TransferSpreadsheet routine:

Sub ExportSQL(strSQL As String)

    Dim db As DAO.Database
    Dim qdf As DAO.QueryDef

    On Error GoTo ExportSQL_Err

    Set db = CurrentDb
    Set qdf = db.CreateQueryDef("qryTemp", strSQL)

    DoCmd.TransferSpreadsheet acExport, , "qryTemp", "C:\Test.xls", True

    On Error Resume Next
    DoCmd.DeleteObject acQuery, "qryTemp"
    Set qdf = Nothing
    Set db = Nothing
    Exit Sub
    Resume ExportSQL_Exit
End Sub


Renee Voice February 26th, 2006 04:47 PM

Dear Bob

Thanks for your reply. I will give it a try and let you know how I go. I think I will find the same problem with transferspreadsheet and probably ADO is the way to go. I just have not had much experience with ADO.

Thanks so much once again.


All times are GMT -4. The time now is 06:38 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.