Blocking of the Table
Blocking at a level of the table is applied at global changes in separately taken table. After you will lead{will carry out} your changes and will close this table, tolkko then other users will get to her access.. At use of an element of management by you data, in his{its} properties establish exclusive = false that users had access to the Database, and svojstvu option appropriate{give} value 3. It will lead to tomy, that the table chosen you (for example authors) will be open with parameters denywrite (1) and denyread (2), that forbids to other users to open this table during action of your program. At attempt of the reference{manipulation} to the blocked table you receive the message:
” could not lock table ' authors'; currently in use by user 'admin' on machine 'user-0000011660' ”
” It is impossible zblokirovat` the table ' authors' since she is used by the manager of the machine 'user-0000011660' ”
Simultaneously with it the mistake - 3265 is generated perekhvatyvaemaja, using which you can finish the program which addresses to the blocked table since after occurrence of a mistake the program continues to be carried out though the table and was not open. At use of an element of management data in obrabotchik events error the following code, but preliminary supplementing previous is inserted:
private sub data1_error (dataerr as integer, response as integer)
select case err
case 3045
msgbox " Access to the Database is closed. Repeat search cherezneskol`ko minutes. " And _, vbcritical, "data_error"
end
case 3265
msgbox " Access to the table is closed. Repeat search in some minutes. " And, vbcritical, "data_error"
end
end select
end sub
If you use object dao at assignment of value to object db establish in false value of the second parameter of a method opendatabase:
set db = dbengine.opendatabase ("c:biblio.mdb", false)
And, at assignment value to object recordset:
set rs = db.openrecordset ("authors", dbopentable, dbdenyread + dbdenywrite)
For interception of an arising mistake again stavte a code:
on error goto errhandler
' Here the code of opening of the table and if there is a mistake - 3265 she is inserted
' It is intercepted and processed
errhandler:
if err = 3265 then
msgbox " Access to the table is closed. Repeat search cherezneskol`ko minutes. " And _
, vbcritical, "data_error"
end
end if
Here it is specified only obrabotchik mistakes of opening of the blocked table since you can open the Database in other procedure, in otlichae from an element data.
Attention! If you will open the application access when you have blocking of the table (in an operating time of your program) the given table opens without the notice of you a dialog box that the table is blocked. But, at all desire you cannot make recording or make editing what or recordings.

|