|
Question : Problem Opening Access 2000 Front-End with Access 2003.
|
|
I have an Access 2k front-end db. All of the workstations that open this db uses Access 2000 with the exception of 1 and it now uses Access 2003. The front-end uses a secured file and I have a little custom start-up db application used to launch the front-end from each individual workstation. This is necessary because the db is used by Customer Service and Sales Reps (15+ workstations) so to make it easier on the IT department when receiving updates, they just load the new workstation to a folder on the server and the next time each machine starts the application from the desktop short cut the startup application will compare the last modified dates in the current local workstation to the new one in the distribution folder on the server and install the newer version if applicable. This all works fine on the Access 2000 workstations but the Access 2003 machine will run the startup application then load the actual application up. Once the startup form in the actual application appears and the user selects which company to work in Access 2003 will throw the "Fatal Windows Error". If I give the Access 2003 machine a shortcut that bypasses the startup application and just launch the acutal application as shown below it seems to work just fine, no fatal errors.
1.) This is the actual shortcut to launch the appliction without using the custom startup db to check for newer versions for which the Access 2003 machine has no problems with.
"C:\Program Files\Microsoft Office\OFFICE11MSACCESS.EXE" "C:\Aquatrack\AQUATRACK50_WorkStation.mdb" /WRKGRP "T:\Aquatrack\AquaSecured.mdw"
2.) This is the actual shortcut to launch the application using the custom startup db to check for newer versions and install.
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "C:\Aquatrack\Aquatrack_Startup.mdb"
3.) The startup.mdb has one form and a function that is called with the AutoExec macro. Seem like there is something in the function below that causes Access 2003 to eventually BARF once it finally opens the workstation application but I just don't see anything obvious.
Function CheckNewVersion() DoCmd.OpenForm "Form1", acNormal DoCmd.SetWarnings False DoCmd.RepaintObject acForm, "Form1"
Sleep (3000) 'Nice splash screen the customer wants to display
Dim dbg As DAO.DBEngine Dim rst As Recordset Dim dbs As Database Dim wks As Workspace Dim varLastMod As Date Dim varLastMod2 As Date Dim RetVal As Double Dim strPath As String
Dim varDrive As String Dim varSecured As String
'Confirm the location of the application on the server varDrive = Left(DLookup("[DRIVE_LETTER]", "StartupGeneral"), 1)
Do Until Dir(varDrive & ":\Aquatrack\AquaSecured.mdw") <> "" If Dir(varDrive & ":\Aquatrack\AquaSecured.mdw") = "" Then varDrive = InputBox("Cannot find " & varDrive & ":\Aquatrack\AquaSecured.mdw. Enter the drive where Aquatrack is installed on your file server.", "", varDrive) If varDrive = "" Then MsgBox "Invalid drive letter.", vbOKOnly, "" DoCmd.Quit Else DoCmd.RunSQL "UPDATE StartupGeneral SET DRIVE_LETTER = '" & Left(varDrive, 1) & "';" varDrive = Left(DLookup("[DRIVE_LETTER]", "StartupGeneral"), 1) End If End If
Loop
'Find the path to local msaccess.exe file Office for 2000 and OFFICE11 for 2003 strPath = "" If Dir("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE") <> "" Then strPath = "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE C:\Aquatrack\AQUATRACK50_WorkStation.mdb /WRKGRP " & varDrive & ":\Aquatrack\AquaSecured.mdw" End If If Dir("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE") <> "" Then strPath = "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE C:\Aquatrack\AQUATRACK50_WorkStation.mdb /WRKGRP " & varDrive & ":\Aquatrack\AquaSecured.mdw" End If If strPath = "" Then MsgBox "Microsoft Access has not been installed in the Office or Office11 folders. Please install first.", vbCritical, "" Exit Function End If
'Check to see if Aquatrack is already running If Dir("C:\Aquatrack\AQUATRACK50_WorkStation.ldb") <> "" Then MsgBox "Aquatrack is currently running. Close all instances of the application and delete any remaining .ldb files if necessary.", vbCritical, "" DoCmd.Quit End If
'Create the Aquatrack folder if it does not exist If Dir("C:\Aquatrack", vbDirectory) = "" Then MkDir ("C:\Aquatrack") End If
'Check to see if the workstation database file has been already deleted from the local drive, if so no need to test the dates just copy the new version down. If Dir("C:\Aquatrack\AQUATRACK50_WorkStation.mdb") = "" Then
Forms!Form1!Label14.Caption = "A later version of the application is available and will be installed on your computer, please wait ....." DoCmd.RepaintObject acForm, "Form1" FileCopy varDrive & ":\Aquatrack\AQUATRACK50_WorkStation.mdb", "C:\Aquatrack\AQUATRACK50_WorkStation.mdb"
Forms!Form1!Label14.Caption = "Starting application ..." DoCmd.RepaintObject acForm, "Form1" RetVal = Shell(strPath, vbMaximizedFocus) 'close startup program DoCmd.Quit
End If
'Create Private DBEngine and set the SystemDB to AquaSecured workgroup file Set dbg = New PrivDBEngine dbg.SystemDB = "T:\Aquatrack\AquaSecured.mdw"
'Create the workspace and open the local workstation to retrieve the last modified date Set wks = dbg.CreateWorkspace("NewWks", "User1", "pswd") Set dbs = wks.OpenDatabase("C:\Aquatrack\AQUATRACK50_WorkStation.mdb")
'Get the last modified date from the current local application Set rst = dbs.OpenRecordset("SetupGeneral", dbOpenDynaset) rst.MoveFirst varLastMod = rst!LAST_MODIFIED
'Open the new workstation used for distribution on the server to retrieve its last modified date Set dbs = wks.OpenDatabase(varDrive & ":\Aquatrack\AQUATRACK50_WorkStation.mdb")
Set rst = dbs.OpenRecordset("SetupGeneral", dbOpenDynaset) rst.MoveFirst varLastMod2 = rst!LAST_MODIFIED
rst.Close dbs.Close
'Compare the two dates If varLastMod < varLastMod2 Then Forms!Form1!Label14.Caption = "A later version of the application is available and will be installed on your computer, please wait ....." DoCmd.RepaintObject acForm, "Form1" If Dir("C:\Aquatrack\AQUATRACK50_WorkStation.mdb") <> "" Then Kill "C:\Aquatrack\AQUATRACK50_WorkStation.mdb" End If FileCopy varDrive & ":\Aquatrack\AQUATRACK50_WorkStation.mdb", "C:\Aquatrack\AQUATRACK50_WorkStation.mdb"
End If
'Start the application Forms!Form1!Label14.Caption = "Starting application ..." DoCmd.RepaintObject acForm, "Form1"
RetVal = Shell(strPath, vbMaximizedFocus)
'close startup program DoCmd.Quit
End Function
Again, the command RetVal = Shell(strPath, vbMaximizedFocus) seems to be executed as the actual application will open to its startup form. Once the user clicks on that form to continue the "Fatal Windows Error" pops up.
I can start it without this startup db and it will work just fine.
I can't see what Access 2003 could be BARFING on.
Any help will be appreciated.
Thanks,
ET
|
|
Answer : Problem Opening Access 2000 Front-End with Access 2003.
|
|
Replace Sleep with a call to this:
Function Wait(intSeconds As Integer) As Integer
Dim datCurDateTime As Date datCurDateTime = Now Do Until DateDiff("s", datCurDateTime, Now) > intSeconds DoEvents Loop End Function
JimD
|
|
|
|