eschloss
Technical User
- Mar 30, 2009
- 2
I have a script which copies an .mdb file and runs the copy. When the .mdb copy is closed, it then deletes it. However, I would rather use the run method, I believe, rather than a looping method. This is where I need help, I do not know how to correctly implement it. Also, I don't know the path of msaccess.exe on the network at work. Do I need to know it?
I also want to maintain the parameters called when opening the copy .mdb currently, specifically automationsecurity.
I have read the following, but my brain has not clicked yet(started learning VBS this weekend).
Thanks in advance,
Erik
Script:
///////////////////////////////////////////////////////////
dim fso
dim obj
dim serverfile
dim clientfile
dim clientcopy
set fso=createobject("scripting.filesystemobject")
serverfile="U:\My Documents\QA Database.mdb"
clientfile=fso.getparentfoldername(wscript.scriptfullname) & "\QA Database(COPY).mdb"
clientcopy=fso.getparentfoldername(wscript.scriptfullname) & "\QA Database(COPY).ldb"
fso.copyfile serverfile,clientfile,true
set obj=createobject("access.application.11")
obj.automationsecurity=1
obj.opencurrentdatabase clientfile
obj.usercontrol=true
if fso.fileexists(clientfile) then
while fso.fileexists(clientcopy)
wend
fso.deletefile clientfile
end if
set fso=nothing
set obj=nothing
I also want to maintain the parameters called when opening the copy .mdb currently, specifically automationsecurity.
I have read the following, but my brain has not clicked yet(started learning VBS this weekend).
Thanks in advance,
Erik
Script:
///////////////////////////////////////////////////////////
dim fso
dim obj
dim serverfile
dim clientfile
dim clientcopy
set fso=createobject("scripting.filesystemobject")
serverfile="U:\My Documents\QA Database.mdb"
clientfile=fso.getparentfoldername(wscript.scriptfullname) & "\QA Database(COPY).mdb"
clientcopy=fso.getparentfoldername(wscript.scriptfullname) & "\QA Database(COPY).ldb"
fso.copyfile serverfile,clientfile,true
set obj=createobject("access.application.11")
obj.automationsecurity=1
obj.opencurrentdatabase clientfile
obj.usercontrol=true
if fso.fileexists(clientfile) then
while fso.fileexists(clientcopy)
wend
fso.deletefile clientfile
end if
set fso=nothing
set obj=nothing