Receive error - Couldn't update; currently locked by user

G

Guest

My question is - what is the best way to enable user to append a record to a
table in a multi user environment. Is it better not to have the form bound
directly to a table? I have a multi user database where users often get the
following error-

"Couldn't update; currently locked by user 'admin' on machine 'computername'"

Error occurs after a specific button is clicked. This code behind this
button is simply meant to save the record to the table. When the users open
the database they are

Button code (this is really all the code there is):
DoCmd.GoToRecord , , acNewRec

Other particulars:
Using Access 97 on a Windows XP
Approx 15-25 concurrent users
Form is bound directly to the table.
Database is not split
Form's Record Locks property is set to "No Locks"
 
A

Allen Browne

Splitting will make a significant difference here: essential IMHO.

Presumably you also have No Locks chosen under:
Tools | Options | Advanced | Default Record Locking

Binding a form directly to a table is such a common scenario (so well
tested) that I doubt changing that will make any difference unless we
talking hundreds of thousands of records in this table.

You can prevent some of these errors by explicitly saving before you do
anything that requires the record to save, such as moving record, applying a
filter, changing the sort order, reassigning the recordsource, closing the
form, closing Access, etc.

The other thing to watch is to unnecessarily dirtying the record.
Especially, avoid dirtying it in Form_Current, where every record has to get
written every time you visit it.

Suggested code for this button:
If Me.Dirty Then
Me.Dirty = False
End If
If Not Me.NewRecord Then
RunCommand acCmdRecordsGotoNew
End If

But splitting is the most important aspect you've skipped.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top