Not really sure what I did in my followup attempt that was different from before but it is working. Revised procedure:
Code:
Private Sub Form_Load()
'Check for updates to the program on start up - if values don't match then there is a later version
If Me.tbxVersion <> Me.lblVersion.Caption Then
'because administrator opens the master development copy, only run this for non-administrator users
If DLookup("Permissions", "Users", "UserNetworkID='" & Environ("UserName") & "'") <> "admin" Then
'copy Access file
CreateObject("Scripting.FileSystemObject").CopyFile _
gstrBasePath & "Program\Install\MaterialsDatabase.accdb", "c:\", True
'allow enough time for file to completely copy before opening
Dim Start As Double
Start = Timer
While Timer < Start + 3
DoEvents
Wend
'load new version - SysCmd function gets the Access executable file path
'Shell function requires literal quote marks in the target filename string argument, hence the quadrupled quote marks
Shell SysCmd(acSysCmdAccessDir) & "MSAccess.exe " & """" & CurrentProject.FullName & """", vbNormalFocus
'close current file
DoCmd.Quit
End If
Else
'tbxVersion available only to administrator to update version number in Updates table
Me.tbxVersion.Visible = False
Call UserLogin
End If
End Sub
You can put the version check behind whatever form you want. However, don't want the copy code to run on your development master so need some way to prevent that.
Yes, table links should eliminate need for VBA connection code.
No, don't run the NormalizeTableLinks procedure every time database opens. This procedure only needs to run when something about the directory structure changes - backend is moved or its folder is renamed - or new tables are created in the backend and those need the UNC pathing. In the case of directory structure changes, will have to manually install the modified frontend onto each user computer because the old version won't be able to find the backend.