This is what I have in my startup form. The red text is my code that was already in the startup form. Perhaps I'm doing that part in the wrong sequence?
Option Compare Database
Option Explicit
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
DoCmd.OpenForm "frmAdministrator", acNormal, , , , acHidden
If fOSUserName = "phenley" Then
DoCmd.OpenForm "frmUsers", acNormal, , , , acHidden
DoCmd.OpenForm "frmMainMenu"
'DoCmd.OpenForm "frmTickler"
'DoCmd.OpenForm "frmPending"
Else
DoCmd.OpenForm "frmSecurity", acNormal
End If
DoCmd.Close acForm, Me.Name
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
Dialog.Box "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
Else
DoCmd.OpenForm "frmAdministrator", acNormal, , , , acHidden
If fOSUserName = "phenley" Then
DoCmd.OpenForm "frmUsers", acNormal, , , , acHidden
DoCmd.OpenForm "frmMainMenu"
'DoCmd.OpenForm "frmTickler"
'DoCmd.OpenForm "frmPending"
Else
DoCmd.OpenForm "frmSecurity", acNormal
End If
DoCmd.Close acForm, Me.Name
End If
End If
End Sub