theKruser
Registered User.
- Local time
- Today, 02:36
- Joined
- Aug 6, 2008
- Messages
- 122
I have a project that I have been developing for the past few years. All of a sudden (today) when I published a new front end, the VBA will not run.
I have a loading form that runs a few basic checks (OnLoad), then opens two other forms and closes itself (OnOpen).
When I open the .accde, my loading form opens, but the OnLoad and OnOpen events do not fire. This project has resided on the same server since its inception.
I have tried:
Recompile
Copy all objects to a new db
Move files to local machine
All have failed to produce results.
I am running Access 2007 on Windows XP. No new service packs or updates have been installed on either.
Due to the proprietary nature of my project, I am unable to post the db. The code for my loading form is below.
I have a loading form that runs a few basic checks (OnLoad), then opens two other forms and closes itself (OnOpen).
When I open the .accde, my loading form opens, but the OnLoad and OnOpen events do not fire. This project has resided on the same server since its inception.
I have tried:
Recompile
Copy all objects to a new db
Move files to local machine
All have failed to produce results.
I am running Access 2007 on Windows XP. No new service packs or updates have been installed on either.
Due to the proprietary nature of my project, I am unable to post the db. The code for my loading form is below.
Code:
[COLOR=black][FONT=Verdana]Option Compare Database[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]Option Explicit[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]Private Sub Form_Load()[/FONT][/COLOR]
[FONT=Verdana][COLOR=black] On Error GoTo ErrorHandler[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]'Check if version is .accdb or .accde[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] If IsACCDE() = True Then[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]'Begin Auto FE Updater code[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Dim strFEMaster As String[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Dim strFE As String[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Dim strMasterLocation As String[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Dim strFilePath As String[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' looks up the version of the front-end as listed in the backend[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] strFEMaster = DLookup("fe_version_number", "tbl-version_fe_master")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' looks up the version of the front-end on the front-end[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] strFE = DLookup("fe_version_number", "tbl-fe_version")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' looks up the location of the front-end master file[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] strMasterLocation = DLookup("s_masterlocation", "tbl-version_master_location")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' checks for the existence of an updating batch file and deletes it if it exists[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] strFilePath = CurrentProject.Path & "\UpdateDbFE.cmd"[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] If Dir(strFilePath) <> "" Then[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Dim fs As Object[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Set fs = CreateObject("Scripting.FileSystemObject")[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] fs.DeleteFile (strFilePath)[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Set fs = Nothing[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] End If[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' if the current database opened is the master then it bypasses the check.[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] If CurrentProject.Path = strMasterLocation Then[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Exit Sub[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Else[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' if the version numbers do not match and it is not the master that is opened,[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' the database will do the update process[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] If strFE <> strFEMaster Then[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] MsgBox "Your program is not the latest version." & vbCrLf & _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] "The front-end needs to be updated. The program will " & vbCrLf & _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] "now close and then should reopen automatically.", vbCritical, "VERSION NEEDS UPDATING"[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' sets the global variable for the path/name of the current database[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] g_strFilePath = CurrentProject.Path & "\" & CurrentProject.Name[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' sets the global variable for the path/name of the database to copy[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] g_strCopyLocation = strMasterLocation[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] ' calls the UpdateFrontEnd module[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] UpdateFrontEnd[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] End If[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] End If[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]'End Auto FE Updater code[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] End If[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]ExitProcedure:[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] On Error Resume Next[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] DoCmd.SetWarnings True[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Exit Sub[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]ErrorHandler:[/FONT][/COLOR]
[FONT=Verdana][COLOR=black] Call ErrHandler(Form.Name, 0, Err.Number, Err.Description)[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Resume ExitProcedure[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Resume[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]End Sub[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]Private Sub Form_Open(Cancel As Integer)[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] On Error GoTo ErrorHandler[/COLOR][/FONT]
[COLOR=black][FONT=Verdana] Dim strSql As String[/FONT][/COLOR]
[FONT=Verdana][COLOR=black] Dim lngAccounts As Long[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] lngAccounts = UserExists()[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Select Case lngAccounts[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Case Is = 0[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Call CreateUser[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Case Is = 1[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] 'Update last login timestamp code goes here[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Case Else[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] MsgBox "You have " & lngAccounts & " accounts. Please inform your System Administrator, " & _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] [Forms]![frmDefaults].[AdminName], vbInformation + vbOKOnly, "Duplicate Account"[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] End Select[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] strSql = "INSERT INTO tblAccessLog (UserName) VALUES (GetUserName())"[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] DoCmd.SetWarnings False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] DoCmd.RunSQL strSql[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] DoCmd.SetWarnings True[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] DoCmd.Close acForm, Form.Name[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] DoCmd.OpenForm "frmDefaults", acNormal, , , , acHidden[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] DoCmd.OpenForm "frmRoster", acNormal[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]ExitProcedure:[/FONT][/COLOR]
[FONT=Verdana][COLOR=black] On Error Resume Next[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] DoCmd.SetWarnings True[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Exit Sub[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]ErrorHandler:[/FONT][/COLOR]
[FONT=Verdana][COLOR=black] Call ErrHandler(Form.Name, 0, Err.Number, Err.Description)[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Resume ExitProcedure[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Resume[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]End Sub[/FONT][/COLOR]