How to see who is using my Access database over the network?

前端 未结 4 866
终归单人心
终归单人心 2021-01-13 07:04

I actually have 2 questions:

1. How might I see who is using my Access database?

  • E.g: There is someone with an Access database opened and it created
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-13 07:39

    I agree with Gord's Original answer. I used this code on my database, it seems that there is a way around computers not being taken out of CurrentConnections upon exit of the DB.

    I placed this on my main menu form because it is always open until the user exits. I used the unload event on my form to get this to work, and it works awesome! Here is my code

    p.s. Ignore SetWarnings I just have that on so the user doesn't have to click through prompts.

    Private Sub Form_Unload(Cancel As Integer)
    Dim wshNet As Object
    Dim deleteSQL As String
    
    Set wshNet = CreateObject("WScript.Network")
            DoCmd.SetWarnings False
            deleteSQL = "DELETE tblCurrentConnections.* " & _
            "FROM tblCurrentConnections WHERE[computerName] = '" & wshNet.computerName & "';"
                    DoCmd.RunSQL deleteSQL
            DoCmd.SetWarnings True
    End Sub
    

提交回复
热议问题