Immediately the second database is opened, the first is closed.
Repeat same code in second database to reverse the process
So as far as I can see it will work - presumably you haven't tried it!
Sorry Colin, I didn't think it would work as I read it that the first DB would still be open. I have tried it now, (every file is saved in the same folder so I assume the only thing I need to replace in the code you kindly provided is the file name - Test.accdb).
So I put the below in a module:
Public Function OpenDatabase()
On Error GoTo ErrHandler
Dim strPath As String, strName As String
strPath = Application.CurrentProject.Path 'change path as necessary
strName = "Test.accdb"
'open external database
Call Shell("msaccess.exe " & strPath & "" & strName, vbMaximizedFocus)
DoEvents
Application.Quit 'this closes the first db in the same code
ExitHandler:
On Error Resume Next
Exit Function
ErrHandler:
MsgBox "Error " & Err.Number & " in OpenDatabase routine : " & Err.Description, vbOKOnly + vbCritical
Resume ExitHandler
End Function
but I get the error:
The command line you used to start Microsoft Access contains an operation that Microsoft Access doesn't recognise.
Exit and restart Microsoft Access using valid command-line options.