DoCmd.RunCommand acCmdExport Question

Posted on 2005-05-08
Last Modified: 2007-10-18
I have a form which has a button that does an export.  I have the code below.  When I click the button it attempts to export the form.  I actually need it to export a specific table called "master".  Any ideas on how to do this????


Private Sub ExportManualLookupLoadForm_Click()
    On Error GoTo ErrHandler
    DoCmd.RunCommand acCmdExport
    Exit Sub
    Select Case Err.Number
        Case 2501
            'Do nothing as cancel selected by user
            Resume ExitHandle
        Case Else
            MsgBox Err.Number & vbCrLf & Err.Description
            Resume ExitHandle
    End Select
End Sub
Question by:ajslentz
    LVL 34

    Accepted Solution

    What format do you want this exported in?

    Take a look a docmd.transfer????? where ??? = Database, Spreadsheet or Text


    Author Comment

    I went a different route using the docmd.transfer.  Thanks for pointing me to that!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Suggested Solutions

    Title # Comments Views Activity
    VBA to filter 17 66
    MS Access question 11 39
    update query variable with apostrope 7 16
    Access left join query 5 7
    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now