How can I run a saved Export in VBA ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simulationguy
    New Member
    • Feb 2010
    • 27

    How can I run a saved Export in VBA ?

    I have several saved exports (querries to text files) and I would like to have a button to execute them in vba and write out all of my data files. Anyone know the syntax for that?
  • Mariostg
    Contributor
    • Sep 2010
    • 332

    #2
    If you are trting to run a saved query through VBA, how about DoCmd.OpenQuery ? Put this inside your action button OnClick.

    Comment

    • simulationguy
      New Member
      • Feb 2010
      • 27

      #3
      its not a saved querry its a saved export. So after I ran the querry I went to the export data menu and set up the way I wanted to export it to a text file directory file name etc and saved that.

      I can go to the export data menu and select the saved export from the list and hit the run button and it recreates it just what I want, but I want to execute that in code.

      Comment

      • gershwyn
        New Member
        • Feb 2010
        • 122

        #4
        You didn't say which version of Access you're using.... but if it's 2007 you can use the DoCmd.RunSavedI mportExport method.

        Comment

        • simulationguy
          New Member
          • Feb 2010
          • 27

          #5
          Thanks! I am using Access 2007 and that was exactly what I was looking for and it worked.

          Comment

          • simulationguy
            New Member
            • Feb 2010
            • 27

            #6
            Crap! Not quite there, the code runs the saved export okay the problem is that the saved export also contains the path name which will not be the same when I give the database to the end user.

            and the textexpport method doesn't write the file out correctly and if I use the specification there is a bug in 2007 (from what I found) that makes it so it can't find the specification even when its been created correctly.

            Comment

            Working...