Microsoft Office 2000/Visual Basic Programmer's Guide   

Handling Locking Conflicts

When working in a single-user environment, your solution doesn't encounter conflicting requests for resources. Because only one user is accessing data at a time, you can reasonably assume that the needed data will always be exclusively available. In a multiuser environment, on the other hand, multiple users may be accessing data at the same time, so the only reasonable assumption is that conflicts will occur when two or more users try to change the same data.

You can prevent such conflicts by making sure that only one user at a time can change data. To protect shared data in this way, you can lock data while a user edits it. When data is locked, any number of users can read it, but only one user can make changes to it.

There are two techniques you can use to lock data in your multiuser solution: (1) bound forms and (2) VBA code that makes direct updates to data in ADO or DAO Recordset objects. When you use bound forms, Access performs certain aspects of locking automatically. Alternatively, you can write your own locking procedures in VBA; this approach gives you more control over your solution's locking behavior. Both techniques are discussed below.