Results 1 to 7 of 7
  1. #1
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50

    User pick location to save expoerted data

    Hello,



    With below VBA I export data to a xml-file. I have not choosen any path so it saves the file to MyDocuments. Preferably I want the user to choose a location where to save the file before the file is saved; so a dialog window should open, location is choosen by the user and then click "Save" or "Export". I have looked for a solution in this forum but have nothing suitable found so far.

    Question is: how to do this?

    Code:
     Application.ExportXML ObjectType:=acExportTable, DataSource:="tblImEx", _
     DataTarget:=Me!VoyageRef & " - " & Me!ShipsName & " - " & Me!DateOfDeparture & ".xml"

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

  3. #3
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50
    Hello RuralGuy,

    I have tried your option but I get the Error that datatype (OFN As tagOPENFILENAME) is not defined. It appears in the Function ahtCommonFileOpenSave. Can't figure out where it goes wrong.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Actually you may just want to select a folder: http://access.mvps.org/access/api/api0002.htm



  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by MrDummy View Post
    Hello RuralGuy,

    I have tried your option but I get the Error that datatype (OFN As tagOPENFILENAME) is not defined. It appears in the Function ahtCommonFileOpenSave. Can't figure out where it goes wrong.
    Did you copy *everything* from
    '***************** Code Start **************
    ...on into a separate standard code module? tagOPENFILENAME is defined right at the beginning of the code.

  6. #6
    MrDummy is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    50
    Ahh that's it. Didn't copy it into a separate module. Now it works, with a few minor adjustments, perfectly. Case closed.

    And of course: many thanks RuralGuy

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent, and you're more than welcome.

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

Similar Threads

  1. FYI: User pick list example
    By ranman256 in forum Tutorials
    Replies: 1
    Last Post: 09-01-2016, 06:09 AM
  2. Replies: 4
    Last Post: 08-26-2015, 02:30 PM
  3. Replies: 2
    Last Post: 10-01-2014, 02:05 AM
  4. Replies: 3
    Last Post: 05-30-2014, 12:34 AM
  5. Eliminate redundant data from Pick Box?
    By jsbdiver in forum Forms
    Replies: 5
    Last Post: 06-14-2010, 04:04 PM

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