Results 1 to 6 of 6
  1. #1
    arunhalyal is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    5

    How to export Query data to Excel with save as dialogue box to save in directory


    Hi,
    I could export query values to excel through below mentioned code

    DoCmd.OutputTo acOutputQuery, "Qry_setter", acFormatXLS, "C:\Temp\Setter.xls", , , True

    But I require a dialogue Box to chose path where I can save file in local directory.
    Please help me on this regard

    Thanks in advance.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You can use some file picker code to store the path in a string. Instead of "File" you use "Folder" in part of the code to call the Windows Dialogue.

    The example DB in this post uses both file and folder. I believe it is "folder" for the path only. The first form that launches in the DB is to go after a file and the second form is the one with an example for folder paths.
    https://www.accessforums.net/access/...tml#post207920

  3. #3
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    This should help you to select a file or directory.

    http://msdn.microsoft.com/en-us/libr.../ff835934.aspx

    Then use the return variable to replace with you DoCmd.


    DoCmd.OutputTo acOutputQuery, "Qry_setter", acFormatXLS, RETURN_VALUE, , , True

  4. #4
    arunhalyal is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    5
    Thanks for reply.

    I need a file to be saved with report number, for example "Furnace121.xls".

    If I give folder name it throughs error and if I pass only file name value it will get saved in My Documents.

    Regads
    Arun

  5. #5
    arunhalyal is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    5
    Thanks for reply.

    I should directly save file in directory. I need not select folder.

    Regards
    Arun

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,901
    Can use the file dialog to pick folder path then concatenate it with whatever filename you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. form - save entered data only with save button
    By cbrxxrider in forum Forms
    Replies: 3
    Last Post: 10-20-2013, 12:39 PM
  2. Export Queries to Excel tabs with Save as Dialog box
    By deepanadhi in forum Import/Export Data
    Replies: 1
    Last Post: 05-16-2012, 10:36 AM
  3. save folder to another directory
    By focosi in forum Programming
    Replies: 7
    Last Post: 08-30-2011, 07:22 AM
  4. Replies: 1
    Last Post: 06-09-2011, 11:10 PM
  5. Replies: 1
    Last Post: 04-17-2011, 04:16 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