Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 25th, 2006, 01:05 AM
Registered User
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.

Old February 26th, 2006, 12:14 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts

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


Old February 26th, 2006, 04:47 PM
Registered User
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

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.


Similar Threads
Thread Thread Starter Forum Replies Last Post
OutputTo .csv nspeelman Access 7 November 17th, 2008 01:37 PM
docmd.outputto Scripts82 Access VBA 0 March 9th, 2006 04:19 AM
outputto command ajmil11 Access 1 February 1st, 2006 08:21 AM
Limit rows returned and next rows minhpx General .NET 1 August 12th, 2004 06:25 AM
limit rows returned in a list box stoneman Access 1 January 16th, 2004 10:46 PM

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