Running to a problem when i change the version number and relaunch the application.
My database:
LRSBudget.accde was the desktop file for the user.
LRSBudget.accdb on shared drive F:\Novermeber Test
LRSBudget_be.accdb on shared drive F:\Novermeber Test
Code:
See below, but it is located on the On_Load of my startup form.
Steps:
-I opened the database with no problems on the first run without making changes to the table.
-I went to a form, added a command button and changed the text, with no code behind it.
-Changed the version table tbl-fe_version to 1.0.2 from 1.0.1
-Changed the version table tbl-version_fe_Master to 1.0.2 from 1.0.1
-Double click LRSBudget.accde on desktop.
-Then produced error saying it cannot find LRSBudget.accde after it deleted the LRSBudget.accde icon.
Any suggestions?
http://www.btabdevelopment.com/ts/freetools
My database:
LRSBudget.accde was the desktop file for the user.
LRSBudget.accdb on shared drive F:\Novermeber Test
LRSBudget_be.accdb on shared drive F:\Novermeber Test
Code:
See below, but it is located on the On_Load of my startup form.
Steps:
-I opened the database with no problems on the first run without making changes to the table.
-I went to a form, added a command button and changed the text, with no code behind it.
-Changed the version table tbl-fe_version to 1.0.2 from 1.0.1
-Changed the version table tbl-version_fe_Master to 1.0.2 from 1.0.1
-Double click LRSBudget.accde on desktop.
-Then produced error saying it cannot find LRSBudget.accde after it deleted the LRSBudget.accde icon.
Any suggestions?
http://www.btabdevelopment.com/ts/freetools
Code:
Private Sub Form_Load()
Dim strFEMaster As String
Dim strFE As String
Dim strMasterLocation As String
Dim strFilePath As String
' looks up the version of the front-end as listed in the backend
strFEMaster = DLookup("fe_version_number", "tbl-version_fe_master")
' looks up the version of the front-end on the front-end
strFE = DLookup("fe_version_number", "tbl-fe_version")
' looks up the location of the front-end master file
strMasterLocation = DLookup("s_masterlocation", "tbl-version_master_location")
' checks for the existence of an updating batch file and deletes it if it exists
strFilePath = CurrentProject.Path & "\UpdateDbFE.cmd"
If Dir(strFilePath) <> "" Then
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile (strFilePath)
Set fs = Nothing
End If
' if the current database opened is the master then it bypasses the check.
If CurrentProject.Path = strMasterLocation Then
Exit Sub
Else
' if the version numbers do not match and it is not the master that is opened,
' the database will do the update process
If strFE <> strFEMaster Then
MsgBox "Your program is not the latest version." & vbCrLf & _
"The front-end needs to be updated. The program will " & vbCrLf & _
"now close and then should reopen automatically.", vbCritical, "VERSION NEEDS UPDATING"
' sets the global variable for the path/name of the current database
g_strFilePath = CurrentProject.Path & "\" & CurrentProject.Name
' sets the global variable for the path/name of the database to copy
g_strCopyLocation = strMasterLocation
' calls the UpdateFrontEnd module
UpdateFrontEnd
End If
End If
End Sub