Results 1 to 6 of 6
  1. #1
    rmayur is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2015
    Location
    Mumbai
    Posts
    20

    Lightbulb Export the query resullt in Excel

    I have one table with data. By using select statement specific data I want to select and Export in Excel. when I am clicking on Export button the excel file generated without data.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    By using select statement specific data I want to select and Export in Excel. when I am clicking on Export button the excel file generated without data.
    Can you explain this in more detail?
    If this some specific to your database?
    Maybe a Form with a command button and some VBA attached to it?
    If so, we will probably need to see the VBA code.

  3. #3
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    Mayur,
    Try this way.

    Create Query > Create Report . Go to design view add button call it export to excel.
    Now go to on click event, create a macro with exportWithFormat , choose output as excel.

    U should be good to go bro.


  4. #4
    rmayur is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2015
    Location
    Mumbai
    Posts
    20
    Yes I required VBA code for export the file.

  5. #5
    darshit_goswami is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Posts
    29
    Click image for larger version. 

Name:	export.PNG 
Views:	19 
Size:	8.8 KB 
ID:	19582
    Isn't this simple for you bro?

  6. #6
    AnandKhinvasara is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    31
    Use below if your query does not have memo fields (more than 255 characters string in single column).
    DoCmd.OutputTo acOutputQuery, "QueryName", _
    acFormatXLS, "ReportName.xls", True

    If your query contains memo fields having more than 255 characters, first output query to a table. And than output table using TransferSpreadsheet method
    Currentdb.Execute "SELECT INTO TableName FROM QueryName"
    docmd.TransferSpreadsheet acExport,acSpreadsheetTypeExcel9, "TableName", "C:\OutputFilePath\OutfileName.xls", True

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

Similar Threads

  1. VBA to export query to Excel
    By randolphoralph in forum Programming
    Replies: 10
    Last Post: 02-03-2014, 07:31 AM
  2. Replies: 7
    Last Post: 04-25-2013, 03:47 PM
  3. Export query to excel
    By Liam87 in forum Queries
    Replies: 1
    Last Post: 12-05-2012, 12:00 AM
  4. Export Query into Excel
    By system243trd in forum Programming
    Replies: 1
    Last Post: 11-24-2012, 08:51 AM
  5. Replies: 3
    Last Post: 10-07-2011, 07:49 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