G
Guest
I have 2 databses: #1 is the main processing db and is split and #2 compacts
and backs up the FE and BE of #1. When I try to open #2 from # 1, Access
crashes. To determine the problem I created two small dbs with 1 forms each.
On the first, I added a button with the following code:
Option Compare Database
Option Explicit
Dim appAccess As Access.Application
Private Sub cmdGo_Click()
On Error GoTo Err_cmdGo_Click
Dim strDB As String
strDB = "C:\Auto\Second.mdb"
Set appAccess = _
CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDB
appAccess.DoCmd.OpenForm "frmMain"
Exit_cmdGo_Click:
Exit Sub
Err_cmdGo_Click:
MsgBox "Error occurred " & Chr(10) & Chr(13) & Err.Description & _
Chr(10) & Chr(13) & "Error number:" & Err.Number
Resume Exit_cmdGo_Click
End Sub
This code consistently crashes on the line:
appAccess.OpenCurrentDatabase strDB
It does not enter the error trap but pops up the following:
"Microsoft Office Access has encountered a problem and needs to close. We
are sorry for the inconvenience." , backs up and repairs the db and sends (or
not) a report to Microsoft.
I also tried to do the same process using the command button wizard which
uses the Shell command but the results were the same. I am running Windows XP
with Access XP (2002 - 2003).
Any suggestions would be appreciated!
and backs up the FE and BE of #1. When I try to open #2 from # 1, Access
crashes. To determine the problem I created two small dbs with 1 forms each.
On the first, I added a button with the following code:
Option Compare Database
Option Explicit
Dim appAccess As Access.Application
Private Sub cmdGo_Click()
On Error GoTo Err_cmdGo_Click
Dim strDB As String
strDB = "C:\Auto\Second.mdb"
Set appAccess = _
CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDB
appAccess.DoCmd.OpenForm "frmMain"
Exit_cmdGo_Click:
Exit Sub
Err_cmdGo_Click:
MsgBox "Error occurred " & Chr(10) & Chr(13) & Err.Description & _
Chr(10) & Chr(13) & "Error number:" & Err.Number
Resume Exit_cmdGo_Click
End Sub
This code consistently crashes on the line:
appAccess.OpenCurrentDatabase strDB
It does not enter the error trap but pops up the following:
"Microsoft Office Access has encountered a problem and needs to close. We
are sorry for the inconvenience." , backs up and repairs the db and sends (or
not) a report to Microsoft.
I also tried to do the same process using the command button wizard which
uses the Shell command but the results were the same. I am running Windows XP
with Access XP (2002 - 2003).
Any suggestions would be appreciated!