|
|

Is a Database already open?
If you wish to check whether a user already has a Database open on their computer, possibly the easiest way of doing this is to try to open the Database exclusively. Obviously, if the database is already open, then this will fail, and produce a trappable error:
Function fIsDatabaseRunning(strDBName As String) As Boolean
'
On Error GoTo E_Handle
fIsDatabaseRunning = True
Dim db As Database
Set db = DBEngine(0).OpenDatabase(strDBName, True)
fIsDatabaseRunning = False
fExit:
On Error Resume Next
db.Close
Set db = Nothing
Exit Function
E_Handle:
Select Case Err.Number
Case 3356
Case Else
MsgBox Err.Description, vbOKOnly + vbCritical, "Error: " & Err.Number
End Select
Resume fExit
End Function
|
Top
HOME |
NEW |
TABLES |
QUERIES |
FORMS |
REPORTS |
GENERAL |
API |
DOWNLOADS |
TUTORIAL |
RESOURCES
E-MAIL
Copyright & Disclaimer
|
| |