bruceblack
Registered User.
- Local time
- Today, 22:57
- Joined
- Jun 30, 2017
- Messages
- 119
Hi folks! Little stuck here. Some help would be very much appreciated 
I'm trying to open another database from another.
There's many threads on this and tried them all with the same result :banghead:
When i open the database, it tries to open the other one, but keeps looping and opens instances over and over until it crashes my system
What is going on?
It erros on acc.DBEngine.OpenDatabase.
But when i use currentdatabase it does the same.
I tried it with a bat file and Shell, same result.

I'm trying to open another database from another.
There's many threads on this and tried them all with the same result :banghead:
When i open the database, it tries to open the other one, but keeps looping and opens instances over and over until it crashes my system
What is going on?
It erros on acc.DBEngine.OpenDatabase.
But when i use currentdatabase it does the same.
I tried it with a bat file and Shell, same result.
Code:
Option Compare Database
Public Function OpenDb(sDb As String)
'On Error GoTo Error_Handler
'Early binding
'Use the following line if being used in Access or using Access reference
' provides intellisense!
Dim oAccess As Access.Application
'Late binding
'Use the following line if being used outside of Access without an Access reference
' Dim oAccess As Object
Set oAccess = CreateObject("Access.Application") 'Create a new Access instance
With oAccess
acc.DBEngine.OpenDatabase 'Open the specified db
.Visible = True 'Ensure it is visible to the end-user
.UserControl = True
' .DoCmd.OpenForm "YourFormName" 'Open a form?
' .DoCmd.RunMacro "YourMacroName" 'Run a Macro?
End With
If Not oAccess Is Nothing Then Set oAccess = Nothing
'Error_Handler_Exit:
On Error Resume Next
Exit Function
Error_Handler:
MsgBox "The following error has occured" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: OpenDb" & vbCrLf & _
"Error Description: " & Err.Description & _
Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
, vbOKOnly + vbCritical, "An Error has Occured!"
' Resume Error_Handler_Exit
End Function
Code:
Private Sub Form_Load()
If Application.Version = "14.0" Then
Call OpenDb("C:\tool\tool 2010.accdb")
End If
End Sub