mrtoanbin > 07-12-20, 11:06 PM
ongke0711 > 07-12-20, 11:48 PM
Dim sDbPath As String
sDbPath = "D:\Temp\Data.accdb"
Shell "cmd /c " & Chr(34) & sDbPath & Chr(34), vbHide
DoCmd.CloseDatabase
Public Function OpenDB(sDbPath As String) As Boolean
On Error Resume EH
Dim oAccess As Object
'sDbPath = "\\Mac\Home\Downloads\Data.accdb" '
Set oAccess = CreateObject("Access.Application")
With oAccess
.OpenCurrentDatabase sDbPath
.Visible = True
.UserControl = True
End With
OpenDb = True
DoCmd.Quit
EH:
OpenDb = False
Msgbox Err.Number & " - " & Err.Description
End Sub