Sub OpenRunTime() Dim accpath As String, dbpath As String On Error Resume Next dbpath = "C:\My Application\MyApp.mdb" Set objAccess = GetObject(dbpath) If Err <> 0 Then If Dir(dbpath) = "" Then 'dbpath is not valid MsgBox "Couldn't find database." Exit Sub Else 'The full version of Microsoft Access is not installed. accpath = "C:\Program Files\Common Files\Microsoft Shared" & _ "\Microsoft Access Runtime\MSAccess.exe" If Dir(accpath) = "" Then MsgBox "Couldn't find Microsoft Access." Exit Sub Else Shell pathname:=accpath & " " & Chr(34) & dbpath & Chr(34), _ windowstyle:=6 Do 'Wait for shelled process to finish Err = 0 Set objAccess = GetObject(dbpath) Loop While Err <> 0 End If End If End If End Sub
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!