Results 1 to 2 of 2
  1. #1
    XDIND is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Posts
    2

    Trouble Creating a button that will export a query to an Excel spreadsheet

    It's been a little while since I've worked a lot with Access, so I'm a little rusty.

    What I'm trying to do is create a button that when clicked, will export a query to an Excel Spreadsheet.

    When the button is clicked, this is what it's trying to do



    Code:
    Private Sub Command0_Click()DoCmd.OutputTo acOutputQuery, "mailinglist", _
     acFormatXLS, "mailinglist.xls", True
    End Sub
    When I click, I'm getting a box that says "Compile Error: Invalid Outside Procedure" with "acOutputQuery" highlighted.

  2. #2
    XDIND is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    May 2013
    Posts
    2
    And of course, right after I post this, I fix the problem...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. command button to export to excel
    By jains in forum Forms
    Replies: 5
    Last Post: 06-30-2015, 06:27 PM
  2. Creating excel spreadsheet from access vba
    By nyneave in forum Programming
    Replies: 1
    Last Post: 10-12-2012, 09:59 AM
  3. Export to excel on button click
    By Jim.H. in forum Access
    Replies: 2
    Last Post: 01-29-2012, 12:16 PM
  4. Replies: 0
    Last Post: 03-13-2011, 03:09 PM
  5. Replies: 1
    Last Post: 08-12-2010, 10:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums