Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 8th, 2006, 03:34 PM
Authorized User
 
Join Date: Aug 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Recordlocking

Hi All,

I've created a databae, back-end (tables) placed on a network-share, front installed on the machines from 5 different users,

Following problem occurs sometimes, in case a Poweruser wants to update the data (using an update qry) the systems does NOT update all records, following error will be shown, 'Microsoft Office Access can't update all the records in the update query,..........'

Does anyone have a solution how to unlock,... test for recordlocking,....


Thx

S.

 
Old March 12th, 2006, 09:30 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi There

I Faced The Same Problem In Access Project Till Now Did Not Solve It But In Access Under Tools ----- Options ------- Default Record Locking ------Press No Locks

I Should Work
Good Luck!!!!!
 
Old March 12th, 2006, 12:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

The other option would be to write an error handler that traps for a record lock error (such as Jet errors 3218 or 3260) , prompts the user to retry the update a specified number of times after random intervals, then traps for a multi-user edit error (3197) when the update is finally successful. The multi-user edit handler notifies the user that the record has been changed by another user, displays the records current value, and asks the user if they want to overwrite the current value with their new value. The code isn’t hard to write, its just an error handler with a Select Case statement. But setting it up depnds on how you are running the update query.

HTH,

Bob


 
Old March 12th, 2006, 11:29 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Probably worth mentioning also if you aren't aware that the "No Locks" default record locking option doesn't really mean that no locking mechanism is used. It means that optimistic locking is used, that is, a lock is placed on the record, but only during the instant in which it is actually updated. The lock is released the instant the update is committed. A write conflict can still occur, however, if user A has edited the record but hasn't saved it yet, then user B updates the record. Optimistic locking allows user B to update the record, but user A will be warned by Access that a write conflict has occurred when they finally attempt to save the record.

The "Edited record" default record locking property means pessimistic lockig is used (a lock is placed on the record when user A begins editing it, and isn't released until user A saves the record. User B can't update the record until it is saved by user A).

The "No Locks" setting may solve your write conflict problem because locks are held for a much shorter period of time using an optimistic locking scheme than they are when using a pessimistic ("Edited record") locking scheme. Just be aware that "No Locks" doesn't necessarily rid you of write conflict issues. They can still occur (as described above); they are simply much less likely to occur.

Bob










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.