469,312 Members | 2,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,312 developers. It's quick & easy.

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?
Sep 17 '10 #1

✓ answered by gershwyn

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

5 15201
Mariostg
332 100+
If you are trting to run a saved query through VBA, how about DoCmd.OpenQuery? Put this inside your action button OnClick.
Sep 17 '10 #2
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.
Sep 17 '10 #3
gershwyn
122 100+
You didn't say which version of Access you're using.... but if it's 2007 you can use the DoCmd.RunSavedImportExport method.
Sep 17 '10 #4
Thanks! I am using Access 2007 and that was exactly what I was looking for and it worked.
Sep 18 '10 #5
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.
Sep 20 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

205 posts views Thread by Jeremy Siek | last post: by
16 posts views Thread by David Lauberts | last post: by
2 posts views Thread by Ted Theodoropoulos | last post: by
2 posts views Thread by safak112 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.