Record Locking

G

Guest

After years of creating stand-alone applications for my own use, I will be
launching a multi-user application for a small workgroup (15 people).
Pessimistic locking seems to be the best strategy for us. Do I need to set
the default record-locking strategy on each machine, or is it specific to the
database?

Thank you.
Sprinks
 
G

Guest

Arvin,

Thank you for your response. What do you do when you have a record locking
problem? Do you allow Access to display its messages, or do you employ
custom code? If the latter, can you provide any general guidelines for doing
so?

Thank you.

Sprinks
 
A

Arvin Meyer [MVP]

I usually will test to see if there is a lock for a few seconds, then use a
message if the lock doesn't clear. Here's a snippet of code:

Error_Handler: 'If someone is editing this record trap the error
If Err = 3158 Then
intRetry = intRetry + 1
If intRetry < 500 Then
Resume
Else 'Time out retries
MsgBox Error$, 48, "This record is locked"
Resume Exit_Here
End If
Else 'Handle other errors
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here
End If

500 tries takes about 3 or 4 seconds, which is usually enough.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
G

Guest

Thanks again, Arvin.

Sprinks

Arvin Meyer said:
I usually will test to see if there is a lock for a few seconds, then use a
message if the lock doesn't clear. Here's a snippet of code:

Error_Handler: 'If someone is editing this record trap the error
If Err = 3158 Then
intRetry = intRetry + 1
If intRetry < 500 Then
Resume
Else 'Time out retries
MsgBox Error$, 48, "This record is locked"
Resume Exit_Here
End If
Else 'Handle other errors
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here
End If

500 tries takes about 3 or 4 seconds, which is usually enough.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

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