Single-user database (1 Viewer)

pepepito78

New member
Local time
Today, 13:34
Joined
Mar 7, 2020
Messages
15
Good Morning, i have a shared bbdd access on network. Do you know how to prevent it from being opened by another user once opened? Thank you
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:34
Joined
May 7, 2009
Messages
19,175
you need vba for that.
if your db is not split, you need to add this on a Module
Code:
Public Function open_denywrite()
    Static rs As DAO.Recordset
    Dim db As DAO.Database
   
    Set db = CurrentDb
    On Error GoTo access_fail
    Set rs = db.OpenRecordset("table1", dbOpenDynaset, dbDenyWrite)
    Exit Function
access_fail:
    MsgBox "Somebody has opened this already!"
    DoCmd.Quit
End Function
create an Autoexec macro that will Run (Runcode) the above function.
"table1" there is but sample table, you may use a "dummy" table or temp table.
 

Ranman256

Well-known member
Local time
Today, 08:34
Joined
Apr 9, 2015
Messages
4,339
No, but if you make it split (sharable), tHen it won't matter.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:34
Joined
Feb 19, 2002
Messages
42,981
Access is multi-user out of the box. If you are created your application using best practice suggestions, there is no need to prevent other simultaneous users. As someone already mentioned, you DO have to split the FE/BE so that only the BE (data) is shared and each user has his own personal copy of the FE (application objects)
 

Users who are viewing this thread

Top Bottom