Version Control Software     Home
' program SJGstepver.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 increment the version number of an Access database. Usage is
' SJGstepver [path-file-name] [version-number]
' where: [path-file-name] is the complete path and file name for the Access database
'
' The SJGVersion property of the database is incremented by one (1). If the SJGVersion property
' is not present, it is created and set to 1.
'

option explicit
dim oArgs, oACC, oWSP, oDB, wVer, oVP
set oArgs = wscript.arguments
wscript.echo oArgs(0)
set oACC = CreateObject("access.application")
set oWSP = oAcc.application.dbengine.workspaces(0)
set oDB = oWSP.opendatabase(oArgs(0), 0 ,0)
on error resume next
wVer = 0
on error resume next
wVer = oDB.Properties("SJGVersion")
if err.number > 0 then
err.clear
set oVP = oDB.createproperty("SJGVersion",4,oArgs(1))
oDB.Properties.append oVP
oVP = nothing
end if
wVer = wVer + 1
set oVP = oDB.createproperty("SJGVersion",4,wVer)
oDB.Properties.append oVP
oDB.properties("SJGVersion") = wVer
wVer = 0
on error resume next
wVer = oDB.Properties("SJGVersion")
wscript.echo "SJGVersion = " & wVer
set oDB = nothing
set oWSP = nothing
set oACC = nothing
set oArgs = nothing