When writing to an Access (Jet) database from VB.
What is the recomended technique for dealing with locks.
ie I am trying to write a record/table that is locked. Should I display a
'Record Locked - Retry?' dialog, or what. How do other people deal with
this?
ChrisM
Hi,
The most common approach is to have a LockingFlag field (this should be
unique and be easy for your program to determine that it belongs to a
specific user, it can also be useful to add a time stamp). e.g.
PaulJ-12-03-2004-18:37.03
The start of the locking process should be to check that the record aka flag
is available. The flag can have three states 1. Blank / null / available,
2. In use / locked, 3, Locked / after system crash.
The first 2 states are easy enough to handle.
The 3rd state is generally left to the user, you could show the locking
flag.
Say use Simon was shown the PaulJ flag with yesterdays date, Simon would be
able to determine this was a system crash. Or, if the time was near, he
could speak to Simon or use his own discretion.
If the flag was free, Simon would have the flag set to state 2.
Finishing with the record it would be set to state 1.
You could even write a feature to clear flags, that are in state 2.
Hope this helps

Signature
Jules.
-------- MDBSecure 2004 - 30 Day Trial -------
Makes MS Access Databases more secure, based on SECFaq.
Imports existing tables, produces jet connection string.
http://www.mindwarp-consultancy-software.com/mdbsecure-free-trial-download.html
Or http://tinyurl.com/yupl5