Question : How can an Access database be opened in a new window using Access VBA?

I have this:

How can an Access database be opened in a new window using Access VBA?

Public Sub OpenDatabase(DatabaseName)

Dim strDB As String
Dim appAccess As Access.Application
Dim strFilename As String
Dim PathIs As String

'**Detect path
'PathIs = Application.CurrentProject.Path

DriveLetter = Left(Application.CurrentProject.Path, 1)
PathIs = DriveLetter & ":\" & DatabaseName
strDB = PathIs & "\" & DatabaseName & ".accdb"

'**Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

'**Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB

'**Open AutoExec form.
appAccess.DoCmd.OpenForm "AutoExec"
   
End Sub
Public Sub OpenDatabase(DatabaseName)

Dim strDB As String
Dim appAccess As Access.Application
Dim strFilename As String
Dim PathIs As String

'**Detect path
'PathIs = Application.CurrentProject.Path

DriveLetter = Left(Application.CurrentProject.Path, 1)
PathIs = DriveLetter & ":\" & DatabaseName
strDB = PathIs & "\" & DatabaseName & ".accdb"

'**Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

'**Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB

'**Open AutoExec form.
appAccess.DoCmd.OpenForm "AutoExec"
   
End Sub

Answer : How can an Access database be opened in a new window using Access VBA?

Did you made any changes on the GAL?
if yes you might need to wait for replication.
Random Solutions  
 
programming4us programming4us