Here's one way.
Sub sOpenDataBase(strDbName As String)
Dim ProcID As Long
Dim strCommandLine As String
' Dim sDataPath As String
If Not FileExists(strDbName) Then
MsgBox "Cannot fine the file " & strDbName & "@Please contact the
database administrator@@"
Else
strCommandLine = Quote(SysCmd(acSysCmdAccessDir) & _
"MSACCESS.EXE") & " " & Quote(strDbName)
ProcID = CLng(Shell(strCommandLine, vbNormalFocus))
Application.Quit acQuitSaveNone ' quit this Db
End If
End Sub
The essential thing is that you launch the other application (using Shell)
and then when shell returns control you simply quit the current application.
Here's the code for FileExists()
Function FileExists(strFile As String) As Boolean
' Comments : Determines if the file exists
' Works for hidden files and folders
' Parameters: strFile - file to check
' Returns : True if the file exists, otherwise false
Dim intAttr As Integer
On Error Resume Next
'GET THE FILE ATTRIBUTE INSTEAD OF THE LENGTH OF THE FILE NAME
intAttr = GetAttr(strFile)
FileExists = (Err = 0)
End Function