Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    nicknameoscar is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2011
    Location
    Earlysville, VA
    Posts
    91
    Lets forget about the code right now. Can you open the query by double clicking on its name in the Access 2007 user interface? If it opens does it give any records?



    Can you zip up a version of your database that doesn't contain any private or personal info (but the query will still return data) and attach it here?

  2. #17
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52
    I am able to view the query with records in it when I double click it.



  3. #18
    nicknameoscar is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Apr 2011
    Location
    Earlysville, VA
    Posts
    91
    Sorry, I am totally unfamiliar with ADP. My apologies if I have wasted your time.

  4. #19
    BigCat's Avatar
    BigCat is offline Vice Pres. of Napping
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    Box Canyon
    Posts
    52
    Here is my final solution that finally works in case anyone else is having this problem and they come across this thread.

    Code:
    Private Sub ExportMPS_Click()
    DoCmd.RunSavedImportExport "Export-MonthlyProductionSummary"
     
    End Sub

  5. #20
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    what's the purpose of the statement DoCmd.OpenQuery stDocName?

    Is the query "Export-MonthlyProductionSummary" an Access query (then you're working with an mdb or accdb file) or a procedure written on the back-end SQL server (then you're working with an .adp project)?
    In the first case you don't have to open it prior to exporting the report based on it, just use the TransferSpreadsheet method.

    In the latter case you run the procedure on the backend using the EXEC command and the OutputTo acStoredProcedure methode as in my code example. (Transferspreadsheet could work there, but in adp projects I always use the OutputTo method which I'm sure works fine)

    So all depends if you're working in a standard .mdb/.accdb Access file linked through ODBC to the back-end, or an .adp project Access on SQL server.

    greetings
    NG

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Report Export to Excel
    By BLD21 in forum Import/Export Data
    Replies: 1
    Last Post: 05-06-2011, 10:19 AM
  2. Export from Access to Excel
    By Eowyne in forum Import/Export Data
    Replies: 5
    Last Post: 04-23-2011, 07:08 PM
  3. Export to Excel with OutputTo
    By kadara in forum Import/Export Data
    Replies: 3
    Last Post: 11-15-2010, 11:35 PM
  4. Export to excel different sheets
    By apsf68 in forum Access
    Replies: 2
    Last Post: 07-27-2010, 07:05 AM
  5. Export to Excel
    By vaikz in forum Import/Export Data
    Replies: 3
    Last Post: 03-25-2009, 09:37 AM

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