There is a way of checking for a new version and automatically updating it if it is out of date. It is something we use on virtually all of our 'Front End' Access applications.
For this to work (as we do it, you can probably modify slightly if required), you need a central location to store the latest 'Master' version (Network drive which everyone can access, for example), a database in this same location (can be elsewhere but makes sense to keep it together) which will hold a table with the Master Version Number in it, and a local table in the 'Front End' copies which will hold the Local Version Number.
So, create a Database called Master Version (in the Network drive), create a Table called tbl_VersionMaster and add a text field called VersionNumber. This will be the Version Number you update when you want to roll out a new version.
In your Front End, create a Table called tbl_VersionLocal, add a text field called VersionNumber. This holds the current version of the front end DB.
In a new Module, add the following:
Code:
Option Compare Database
Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
So, in the database, I load a Form on startup which acts as a 'Splash Screen'. I then use a Onload event to run the update process. So:
Code:
Dim strVerClient As String, strVerServer As String
strVerClient = Nz(DLookup("[VersionNumber]", "[tbl_VersionClient]"), "")
strVerServer = Nz(DLookup("[VersionNumber]", "[tbl_VersionMaster]"), "")
If strVerClient = strVerServer Then
'OK, the local version number matches the master version so we don't need to update. Generally you would add some code here to close the 'Splash Screen' form and open your main navigation form
Else
Dim strSourceFile As String, strDestFile As String
Dim strAccessExePath As String, lngResult As Long
'Create the source's path and file name.
strSourceFile = "EnterThePathToYourMasterVersionHere.mdb"
'Change this value to the path to the Master Version you have on the network
strDestFile = CurrentProject.FullName
'Determine path of current Access executable
strAccessExePath = SysCmd(acSysCmdAccessDir) & "MSAccess.exe "
If Dir(strSourceFile) = "" Then 'Something is wrong and the file is not there.
MsgBox ("Please see system administrator")
Else 'copy the new version of app over the existing one.
lngResult = apiCopyFile(strSourceFile, strDestFile, False)
End If
'Modify strDestFile slightly so that it can be used with the Shell function
strDestFile = """" & strDestFile & """"
MsgBox "Application Updated. Please wait while the application restarts.", _
vbInformation, "Update Successful"
'Load new version, then close old one.
Shell strAccessExePath & strDestFile & "", vbMaximizedFocus
DoCmd.Quit
End If
In your Database, you need to link the tbl_VersionMaster table which is held in the Master Version database created earlier.
To start with, make these modifications to your database and set both the local and master versions to 1.0
Make sure all your users have a copy of the new front end and place a copy of it on the network drive (make sure the path is exactly the same as the one entered above, i.e. 'strSourceFile = "EnterThePathToYourMasterVersionHere.mdb"')
When you need to roll out an update, make your modifications to the master version (on the network drive) and then update both the tbl_VersionLocal and tbl_VersionMaster tables to a new version number (e.g. 1.1).
So, when your users next open their front end, their local version will be 1.0, but the master version (in their linked table) will show as 1.1. This will kick off the update process and will copy over the latest master version and will restart their database.
This will now show both their local version and master version as 1.1 and so the database will then open as normal.
Any probs, post them here and I'll try to help