L
Lynda
Hello:
I hope someone can tell me what is wrong with a VBS program on my local
drive. The VBScript file checks to see if there is a newer version of my
Access database file located out on a shared network drive. If the version
number is higher than the database located on my C drive, then the vbs
script saves my current application as Savexxxx.mdb, imports the newer
application and then opens the newer version of the Access application. For
some reason, the vbs script is able to complete most of the commands except
for the final one where it opens up the newer database application.
This script worked just fine until recently (about around December 2008) and
then just stopped working properly. This VBS script works just fine for
everyone else in my office so I think that I am obviously the problem.
Something is blocking this from completing.
I am attaching the script below. Perhaps someone can tell me if there is
some setting that I need to fix on my local laptop. I am running Windows
XP, Microsoft Outlook connected to microsoft exchange server (the same as my
co-workers). As far as I can tell, there shouldn't be anything diferent for
me.
I hope someone can give me an answer. Here is the script.
Dim WshShell
dim Path
dim CurrentDirectory
dim MasterDirectory
dim OldVersionNum
dim NewVersionNum
Set WshShell = WScript.CreateObject("WScript.Shell")
set FSO = wscript.createobject("Scripting.FileSystemObject")
Set conn = Wscript.CreateObject("ADODB.Connection")
set rs = wscript.createobject("ADODB.recordset")
Path= WshShell.RegRead("HKCU\Software\VB and VBA Program Settings\UMF
Prospects\UMF Prospects\DataPath")
MasterDirectory = Left(path, InstrRev(path, "\"))
path = WScript.ScriptFullName
CurrentDirectory= Left(path, InstrRev(path, "\"))
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.ConnectionString = "data source= " & currentdirectory & "pxprog.mdb"
conn.Open
rs.open "Version",conn
OldVersionNum = rs("VersionNumber")
rs.close
conn.close
conn.ConnectionString = "data source= " & MasterDirectory & "pxprog.mdb"
conn.Open
rs.open "Version",conn
NewVersionNum = rs("VersionNumber")
set rs = nothing
set conn = nothing
if NewVersionNum > OldVersionNum then
WScript.Echo "Newer Prospect Program Version is Available"
FSO.CopyFile CurrentDirectory & "pxprog.mdb", CurrentDirectory &
"SavepxProg.mdb", True 'true means overwrite
FSO.CopyFile MasterDirectory & "pxprog.mdb", CurrentDirectory &
"pxProg.mdb", True
end if
set FSO = nothing
WshShell.Run CurrentDirectory & "pxprog.mdb", 1
WScript.Sleep 300
WshShell.AppActivate "ACCESS"
set wshShell = nothing
I hope someone can tell me what is wrong with a VBS program on my local
drive. The VBScript file checks to see if there is a newer version of my
Access database file located out on a shared network drive. If the version
number is higher than the database located on my C drive, then the vbs
script saves my current application as Savexxxx.mdb, imports the newer
application and then opens the newer version of the Access application. For
some reason, the vbs script is able to complete most of the commands except
for the final one where it opens up the newer database application.
This script worked just fine until recently (about around December 2008) and
then just stopped working properly. This VBS script works just fine for
everyone else in my office so I think that I am obviously the problem.
Something is blocking this from completing.
I am attaching the script below. Perhaps someone can tell me if there is
some setting that I need to fix on my local laptop. I am running Windows
XP, Microsoft Outlook connected to microsoft exchange server (the same as my
co-workers). As far as I can tell, there shouldn't be anything diferent for
me.
I hope someone can give me an answer. Here is the script.
Dim WshShell
dim Path
dim CurrentDirectory
dim MasterDirectory
dim OldVersionNum
dim NewVersionNum
Set WshShell = WScript.CreateObject("WScript.Shell")
set FSO = wscript.createobject("Scripting.FileSystemObject")
Set conn = Wscript.CreateObject("ADODB.Connection")
set rs = wscript.createobject("ADODB.recordset")
Path= WshShell.RegRead("HKCU\Software\VB and VBA Program Settings\UMF
Prospects\UMF Prospects\DataPath")
MasterDirectory = Left(path, InstrRev(path, "\"))
path = WScript.ScriptFullName
CurrentDirectory= Left(path, InstrRev(path, "\"))
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.ConnectionString = "data source= " & currentdirectory & "pxprog.mdb"
conn.Open
rs.open "Version",conn
OldVersionNum = rs("VersionNumber")
rs.close
conn.close
conn.ConnectionString = "data source= " & MasterDirectory & "pxprog.mdb"
conn.Open
rs.open "Version",conn
NewVersionNum = rs("VersionNumber")
set rs = nothing
set conn = nothing
if NewVersionNum > OldVersionNum then
WScript.Echo "Newer Prospect Program Version is Available"
FSO.CopyFile CurrentDirectory & "pxprog.mdb", CurrentDirectory &
"SavepxProg.mdb", True 'true means overwrite
FSO.CopyFile MasterDirectory & "pxprog.mdb", CurrentDirectory &
"pxProg.mdb", True
end if
set FSO = nothing
WshShell.Run CurrentDirectory & "pxprog.mdb", 1
WScript.Sleep 300
WshShell.AppActivate "ACCESS"
set wshShell = nothing