Shuja Umer
Shuja Umer

Reputation: 21

Using VBA to disconnect users from using MS Access by third party applications

I have an MS Access database (2010) to which multiple users are connecting by using third party applications. Users are already requested to close applications using the database, but most of the users forgets. There is an overnight job runs every day that updates the database. As the database is busy, the update fails. Can someone help me with VBA script that checks if any users are connected and disconnect if there are any?

Regards

Upvotes: 1

Views: 792

Answers (1)

snibbo
snibbo

Reputation: 189

I use a hidden form which is loaded on starting the MS Access file. On this form I use the timer event checking something like:

If Hour(Now()) > 22 Then
   If Minute(Now()) > 50 Then
      Application.Quit
   End If
End If

If you are using AM und PM, you need to change "If Hour(Now()) > 22 Then" accordingly.

Upvotes: 1

Related Questions