Locking Shared Data with Bound Forms

The easiest way to create a multiuser application is to create forms that are bound to tables or queries. You control how Microsoft Access locks data by setting multiuser options and form properties.

Selecting a Locking Strategy

When you share data with bound forms, you can specify how Microsoft Access locks records in a form. There are three locking strategies to choose from:

To set a locking strategy for all forms in the database, select one of these options on the Advanced tab of the Options dialog box (Tools menu). If you want to set the locking strategy for an individual form, set the form’s RecordLocks property to one of these settings. You can specify a locking strategy for one, many, or all forms in a database by setting the RecordLocks property in code.

See Also   For more information on the RecordLocks property, search the Help index for “RecordLocks property.”

Setting Locking Options

In addition to specifying a locking strategy, you can set other options that control how Microsoft Access handles locking in your multiuser application. The following options help you avoid locking conflicts with other users:

You set these options on the Advanced tab of the Options dialog box (Tools menu). Alternatively, you can set these options in code by using the SetOption method of the Application object. For example, the following lines of code set the Number Of Update Retries and the Update Retry Interval options:

Application.SetOption "Number of Update Retries", 5
Application.SetOption "Update Retry Interval (msec)", 500

When you share data with bound forms, Microsoft Access displays standard messages when locking conflicts occur.