Code doesn't work in run-time

  • Thread starter Thread starter Matt Kisasonak
  • Start date Start date
M

Matt Kisasonak

Call for Help! When my switchboard opens (OnOpen) I have
code that compares the FileDateTime of the local
application to an app on the network. If the net app is
newer, the code shells an .exe that does the following.

Set objAccApp = GetObject(strLocFile)
objAccApp.CloseCurrentDatabase
FileSystem.FileCopy strNetFile, strLocFile
objAccApp.OpenCurrentDatabase strLocFile
MsgBox "Update Complete."

This works if I step through the code or even run it in
VB but I get an error stating that it can't find the
local file when I run the .exe file.

I know that I can share the .mdb on the network but don't
want to do this because then I can't update it. I have
Office 2002 but don't have Developer which has "package
and deploy".

Help is much appreciated

Matt
 
Matt,

It might simply be a timing issue, but before we go down that track, I'd
modify your code a bit:

Set objAccApp = GetObject(strLocFile)
objAccApp.CloseCurrentDatabase
FileSystem.FileCopy strNetFile, strLocFile
Set objAccApp = GetObject(strLocFile) '*** Add this line
objAccApp.OpenCurrentDatabase strLocFile
MsgBox "Update Complete."

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top