Single-user database (1 Viewer)

pepepito78

New member
Local time
Today, 17:11
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

error reading drive A:
Local time
Today, 23:11
Joined
May 7, 2009
Messages
9,286
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

Registered User.
Local time
Today, 11:11
Joined
Apr 9, 2015
Messages
3,549
No, but if you make it split (sharable), tHen it won't matter.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:11
Joined
Feb 19, 2002
Messages
28,755
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 (Users: 0, Guests: 1)

Top Bottom