Okay first question was about hiding the command window. Use the vbHide
constant in the Shell command
Shell( "batchfilename", vbHide)
Now as to versioning.
You need a table in the back end database. It only needs one field and one
row. It should have a value that identifies the current version. I would
suggest it be a text field. For example:
tblServerVersion
CurrentVersion - Text
You would link that table to your front end.
Then in the front end mdb you will have a local table that would identical
except for the table name
tblClientVersion
CurrentVersion - Text
Now, if you have a form that opens when your application opens, you can use
that, if not, you need a form that is identified as the startup form or you
could use a function in a standard module and call it from a Macro named
AutoExec.
If an mdb has a macro named AutoExec, it will run when you open the
application. I will use that as an example. The idea is you compare the
version numbers from the be and the fe and if the fe version is less than the
be version, you shell to the bat file and quit the application; otherwise,
you open your startup form. Note, if you use this method, you don't identify
your startup form in the startup properties.
Public Function CheckVersion()
Dim varServerVersion As Variant
Dim varClientVersion as Variant
varServerVersion = DLookup("[CurrentVersion]", "tblServerVersion")
varClientVersion = DLookup("[CurrentVersion]", "tblClientVersion")
If IsNull(varServerVersion) Or IsNull(varClientVersion) Then
MsgBox "No Version Data Found", vbCritical
Docmd.Quit
Exit Function
End If
If varClientVersion < varServerVersion Then
MsgBox "This application is out of date" & vbNewLine & _
"Click Okay to Update your Application" & vbNewLine & _
"This may take a minutes", vbInformation, "Version Update
Required"
Shell("batchfilenamegoeshere", vbHide)
Docmd.Quit
Else
Docmd.OpenForm "StartUpFormName"
End If
End Function
Now, I use like 1.0 1.1, 1.2, etc. So I would start with 1.0 in both tables.
So when you make modifications to your front end and you want to deploy a
new version, you change the CurrentVersion field in the front end to 1.1 and
put the mdb in the update directory.
Then you open the back end database and change the Current Version to 1.1
Now when a user opens their existing mdb, it will still say 1.0, so when the
code runs, it will see the server says the current version is 1.1 it will
cause the batch file to run and the application will close. As soon as the
copy is complete, the batch file opens the application again, but now it is a
copy of the new 1.1 version and the startup form will open.
--
Dave Hargis, Microsoft Access MVP
Arturo said:
Tell me about the version numbers, please.