Results 1 to 11 of 11
  1. #1
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71

    setting file path for saved import / export


    I am looking for help in using the ImportExportSpecification properties (especially .path) to set the file path from a form text box through vba.
    I have got the text box already showing the current database project file path.
    All I want is to use this string to link up in the saved importexport paths.
    I am importing and exporting access tables from one db to another and also exporting tables as excel files.
    There seems to be mixed reaction to similar question on various other forums but no specific solution or example.

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Are you doing this in a macro or VBA? Give us the details of the process behind the ... is it a button that triggers this event?

  3. #3
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71
    Text box for the current db project file path in the master panel form is filled through a vba module function on open form.
    I have used CurrentProject.path for this in vba module.
    I could also use the same text box for user to fill in manually any other file path he wants to make it more flexible.
    My question is how to use this text box path string to set in the saved ImportExportSpecifications.path.
    It would be ideal if at the same time of opening the form, the saved ImportExportSpecifications .path property can be set by vba.
    This way, every time the master panel form is opened (which is the opening form for the project), the file path for all saved imports and exports can be set to the current db project file path automatically.
    Hope there is a solution to this which will make the db more flexible for user.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You say that the default CurrentPath is already showing in the textbox when the form is opened. For all your imports and exports you can use this path and add the file name on the end, such as
    Dim FileName as String
    FileName=Me!PathName & "\ExportExcel.xls"

  5. #5
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71
    aytee111 Tks for yr suggestion.
    I tried writing the FileName as suggested by you into the "Manage Data Tasks" dialog box for saved export and imports.
    I tried both Me!PathName and Forms![MasterPanel]![PathName].
    When I run the vba DoCmd.RunSavedImportExport ("SavedTaskName") for the particular saved task, error message is returned "Can't save the output data to the file you've selected.".
    I think the path has to be set in vba using the .path property of ImportExportSpecifications.
    I need to understand the proper method or procedure in vba to do this if it is possible.

  6. #6
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71
    Incidentally, I can use docmd.transfer method individually to perform the function as required.
    I was looking for a way to use the saved ImportExports to make it more flexible.
    If you have any ideas in this context, please advise.
    Thanks

  7. #7
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I have never used that method, the saved ImportExports. I always do them in VBA, using the transfer method. What advantage do you gain? You say it makes it more flexible, I'd be interested to learn in what ways.

    Also, you mentioned above that the user can change the path, not sure if you know you can have a "Browse" button for that.

  8. #8
    SodaPop is offline Novice
    Windows 8 Access 2007
    Join Date
    Mar 2014
    Posts
    16
    I have a db with a button which opens file picker dialog to allow a user to select a file location. The sets the file download location. I use this to drive a multitude of things, one being moving files to the set location. All in vba. Is this what you need?

    Sent from my SM-G950U using Tapatalk

  9. #9
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71
    Aytee111 / Sodapop
    Thanks for yr ideas.
    I guess a combination of "Browser" dialog with vb is most flexible.
    I have now changed my excel exports to direct vb instead of savedexport.
    It would help if you can share some simple samples for me for access table transfer.

    PS: I was out of action last week due to a death in our family and could not respond earlier.

  10. #10
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Sorry to hear that, all our sympathy.

    There are many samples of "Browse For Folder" VBA code. You are on 2016 and some of them may no longer work. Find one that works for you.

  11. #11
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71
    Thanks to all.
    After being away, finally got the time to find solution to my requirement.
    Regards

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

Similar Threads

  1. Replies: 6
    Last Post: 03-27-2017, 10:39 AM
  2. My saved import/export are gone
    By egyhamada in forum Import/Export Data
    Replies: 4
    Last Post: 02-06-2016, 08:47 AM
  3. Replies: 1
    Last Post: 10-29-2015, 07:03 AM
  4. Replies: 13
    Last Post: 12-12-2013, 07:22 PM
  5. How do I set a link from a saved path
    By cowboy in forum Reports
    Replies: 5
    Last Post: 02-16-2010, 12:43 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