What am I thinking? It's not .log it's .ldf.
Sorry.
Thanks!
Main Topics
Browse All TopicsIs there away to detect if the MDB that is being opened is allready open?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
So you want to make sure the same user does not open it twice?
What if on open you create like a user table and you add something to the table to denote they are in it. And when they close out, it removes them from the table. Then you can just do a check in the table to see if they exist or not and give them an error message if so.
THanks!
Hi all,
Here is some code i came accross that prevent a second instance opening....
1. In a module place this code....
2. In the first line of the Autoexec macro place a runcode action with winCheckMultipleInstances(
Hope this helps
Mavreich
Option Compare Database
Option Explicit
' Module mdlCheckMultipleInstances
' © Graham Mandeno, Alpha Solutions, Auckland, NZ
' graham@alpha.co.nz
' This code may be used and distributed freely on the condition
' that the above credit is included unchanged.
Private Const cMaxBuffer = 255
Private Declare Function apiGetClassName Lib "USER32" _
Alias "GetClassNameA" _
(ByVal hwnd As Long, _
ByVal lpClassname As String, _
ByVal nMaxCount As Long) _
As Long
Private Declare Function apiGetDesktopWindow Lib "USER32" _
Alias "GetDesktopWindow" _
() As Long
Private Declare Function apiGetWindow Lib "USER32" _
Alias "GetWindow" _
(ByVal hwnd As Long, _
ByVal wCmd As Long) _
As Long
Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2
Private Declare Function apiGetWindowText Lib "USER32" _
Alias "GetWindowTextA" _
(ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal aint As Long) _
As Long
Private Declare Function apiSetActiveWindow Lib "USER32" _
Alias "SetActiveWindow" _
(ByVal hwnd As Long) _
As Long
Private Declare Function apiIsIconic Lib "USER32" _
Alias "IsIconic" _
(ByVal hwnd As Long) _
As Long
Private Declare Function apiShowWindowAsync Lib "USER32" _
Alias "ShowWindowAsync" _
(ByVal hwnd As Long, _
ByVal nCmdShow As Long) _
As Long
Private Const SW_SHOW = 5
Private Const SW_RESTORE = 9
Public Function winGetClassName(hwnd As Long) As String
Dim sBuffer As String, iLen As Integer
sBuffer = String$(cMaxBuffer - 1, 0)
iLen = apiGetClassName(hwnd, sBuffer, cMaxBuffer)
If iLen > 0 Then
winGetClassName = Left$(sBuffer, iLen)
End If
End Function
Public Function winGetTitle(hwnd As Long) As String
Dim sBuffer As String, iLen As Integer
sBuffer = String$(cMaxBuffer - 1, 0)
iLen = apiGetWindowText(hwnd, sBuffer, cMaxBuffer)
If iLen > 0 Then
winGetTitle = Left$(sBuffer, iLen)
End If
End Function
Public Function winGetHWndDB(Optional hWndApp As Long) As Long
Dim hwnd As Long
winGetHWndDB = 0
If hWndApp <> 0 Then
If winGetClassName(hWndApp) <> "OMain" Then Exit Function
End If
hwnd = winGetHWndMDI(hWndApp)
If hwnd = 0 Then Exit Function
hwnd = apiGetWindow(hwnd, GW_CHILD)
Do Until hwnd = 0
If winGetClassName(hwnd) = "ODb" Then
winGetHWndDB = hwnd
Exit Do
End If
hwnd = apiGetWindow(hwnd, GW_HWNDNEXT)
Loop
End Function
Public Function winGetHWndMDI(Optional hWndApp As Long) As Long
Dim hwnd As Long
winGetHWndMDI = 0
If hWndApp = 0 Then hWndApp = Application.hWndAccessApp
hwnd = apiGetWindow(hWndApp, GW_CHILD)
Do Until hwnd = 0
If winGetClassName(hwnd) = "MDIClient" Then
winGetHWndMDI = hwnd
Exit Do
End If
hwnd = apiGetWindow(hwnd, GW_HWNDNEXT)
Loop
End Function
Public Function winCheckMultipleInstances(
Dim fSwitch As Boolean, sMyCaption As String
Dim hWndApp As Long, hWndDb As Long
On Error GoTo ProcErr
sMyCaption = winGetTitle(winGetHWndDB()
hWndApp = apiGetWindow(apiGetDesktop
Do Until hWndApp = 0
If hWndApp <> Application.hWndAccessApp Then
hWndDb = winGetHWndDB(hWndApp)
If hWndDb <> 0 Then
If sMyCaption = winGetTitle(hWndDb) Then Exit Do
End If
End If
hWndApp = apiGetWindow(hWndApp, GW_HWNDNEXT)
Loop
If hWndApp = 0 Then Exit Function
If fConfirm Then
If MsgBox(sMyCaption & " is already open@" _
& "Do you want to open a second instance of this database?@", _
vbYesNo Or vbQuestion Or vbDefaultButton2) = vbYes Then Exit Function
End If
apiSetActiveWindow hWndApp
If apiIsIconic(hWndApp) Then
apiShowWindowAsync hWndApp, SW_RESTORE
Else
apiShowWindowAsync hWndApp, SW_SHOW
End If
Application.Quit
ProcEnd:
Exit Function
ProcErr:
MsgBox Err.Description
Resume ProcEnd
End Function
julypobox:
Just a follow-up to the query parameter recordset question I helped you with previously (http://www.experts-exchan
Business Accounts
Answer for Membership
by: Pigster14Posted on 2005-12-20 at 13:47:55ID: 15522149
Not sure if this is an option, but usually when a .mdb is open there is a .log. Maybe see if that .log is open and then that would help.
However, I know sometimes if you get locked up in a database and close out it will keep that .log out there. So it is not a 100% accurate test, but it's an idea.
Thanks.