|
Question : Locking a Table?
|
|
How can I lock a Table in Access to prevent anyone else from using it? And how can I check whether a Table is currently locked?
I would like to Lock a table before going into a Form in which I use this table in a Dropdown. I don't to prevent everyone else from using this while I'm in this form.
|
|
Answer : Locking a Table?
|
|
You can also use a recordset to prevent users accessing it while you have access t it.
In open form event
Dim dbs As Database, rst As Recordset Dim strSQL As String
' Return reference to current database. Set dbs = CurrentDb strSQL = "SELECT * FROM Orders WHERE [ShipCountry] = 'UK'" ' Set rst = dbs.OpenRecordset(strSQL) Set rs = db.OpenRecordset(strsql, dbOpenTable, dbDenyWrite, True) rst.MoveLast Debug.Print rst.RecordCount rst.Close Set dbs = Nothing
|
|
|