# Solved: Run Saved Exports vbscript



## draceplace (Jun 8, 2001)

In MS Access 2007 there is a "Saved Exports" on the tool bar. Can you run one of those with a vbscript in form/button?


----------



## Ziggy1 (Jun 18, 2002)

Explain what you are trying to do, you can automate the Export with VBA (without using the Saved export)


----------



## draceplace (Jun 8, 2001)

Thanks for the reply Ziggy1. I just thoght it would be handy if you could call the export rather than writing one just like it. Apparently no one knows how you might call/or edit one.


----------



## Ziggy1 (Jun 18, 2002)

draceplace said:


> Apparently no one knows how you might call/or edit one.


Ya but that's because making a macro or VBA is just as easy to do in the time you spend running the Export and saving it? In fact you can just select all the Macro Actions than then go to "Database Tools" menu and Access will write the code for you ( convert to Visual basic).


----------



## draceplace (Jun 8, 2001)

New topic while I've got your attention.

I'm trying to map a drive from a form. 

Set objNetwork = CreateObject("WScript.Network")
strDriveLetter = "Y:"
strPathServer = Mapd_txt 'from Form text box
objNetwork.MapNetworkDrive strDriveLetter, strPathServer

strPathServer is this \\dhsdconasp1\dco_oppd\data\ACES\Partial\

The problem is I get the 'network name not found' message.

When I manually map by pasteing the string then run the code above I get the 'local device name already in use' 

So why doesn't my code map it in the first place?


----------



## Ziggy1 (Jun 18, 2002)

I'm not sure, I've never had to map a drive in my code... I'm guessing you are using this with the Export? Can't you just supply the Path to the folder?

Just thought I'd mention to your earlier question... not sure if it applies, but you seem to be working on something automated, but you can make your Database Auto execute by naming a Macro AutoExec... you can call it to open then trigger what you want (Export) and close.


----------



## draceplace (Jun 8, 2001)

Thanks for your time Ziggy1, I do appreciate your reply...

No they are two separate issues. The export question was more of a 'it would be nice if I didn't have to type the export code". I saw that the new version of Access saves the export I just thought it would be nice to reuse them.

The Map Drive issue :
I have a bunch of monthly tables (going back to 2001) that I get request(s) to report from. I've made a form that allows you to link these tables by year by clicking a button. 

I've found that some programmers get same Drives mapped differently depending on what division they work for. To make the form work for them (anyone) I was wanting to map the share in the form so the 'link table' buttons would always work...Also next time you open the db after linking tables you need to re-map to access the tables if you have logged off and lost the drive mapping.

The only other 'map drive' I've done is logon scripts. I should probably start a new thread...tomorrow


----------



## Rollin_Again (Sep 4, 2003)

Have you tried adding double quotes to the network path variable?

*objNetwork.MapNetworkDrive strDriveLetter, chr(34) & strPathServer & chr(34)*

Regards,
Rollin


----------



## draceplace (Jun 8, 2001)

Hey Rollin_Again, thanks for the reply.

There are double quotes in the text box on the form. I could try hardcoding in the code to see if thats the issue. I've got the db running a long query at the moment. 

What make me think that it is seeing the path clearly is when the drive is mapped it manually then you run the code it comes back with the 'local device name already in use'. I guess it could be just referring to the Drive Letter an not the share?

I'll hard code in the morning. As I mentioned I've started a long running query on this...

I've discovered that network discovery and file share is turned off (I don't have power to turn on) You think this is going to be the problem?


----------



## draceplace (Jun 8, 2001)

I removed the the trailing "\" . In the text box mapd_txt the default value looks like this..

"\\dhsdconasp1\dco_oppd\data\ACES\Partial" with double quotes and NO trailing "\"

Thanks Rollin_Again and Ziggy1 for helping!!

Never did figure out how to reuse 'saved exports'...


----------

