Version Control Software Home
' program SJGInstall.vbs ' copyright (c) 2000, Steve Goodhall, all rights reserved ' No warranty expressed or implied ' Bug reports and comments to SGoodhall@home.com ' ' This script is invoked to perform a conditional installation of a new version of an Access ' Front End (Code Only) database. Usage is: ' ' cscript SJGInstall.vbs [source-path-file-name] [target-path-file-name] ' where: [source-path-file-name] is the complete path and file name for the Access database to be installed ' [target-path-file-name] is the complete path and file name for the Access database to be replaced ' ' The version number of the new version is compared with the ' version number of the old version. If it is greater, the new version is copied over the old ' version. If the SJGVersion property is missing from either database, its version number is ' presumed to be zero(0). option explicit dim oArgs, oAcc, oWSP, oDB, oFSO dim wVer0, wVer1 set oArgs = wscript.arguments wscript.echo oArgs(0), oArgs(1) set oACC = CreateObject("access.application") set oWSP = oAcc.application.dbengine.workspaces(0) set oDB = oWSP.opendatabase(oArgs(0), 0 ,0) wVer0 = 0 rem on error resume next wVer0 = oDB.Properties("SJGVersion") wscript.echo "SJGVersion(0) = " & wVer0 set oDB = nothing set oDB = oWSP.opendatabase(oArgs(1), 0 ,0) wVer1 = 0 rem on error resume next wVer1 = oDB.Properties("SJGVersion") wscript.echo "SJGVersion(1) = " & wVer1 set oDB = nothing if wVer0 > wVer1 then wscript.echo "copying" set oFSO = CreateObject("Scripting.FileSystemObject") err.clear oFSO.CopyFile oArgs(0), oArgs(1), -1 if err.number > 0 then wscript.echo "error on copy " & err.number & " " & err.description end if set oFSO = nothing else wscript.echo "V0=" & wVer0 & " V1=" & wVer1 end if set oDB = nothing set oWSP = nothing set oACC = nothing set oArgs = nothing