Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i know if a record is locked 1

Status
Not open for further replies.

Cyberseduct

Programmer
May 25, 2001
6
MU
I am using an Access db in VB 6 and my system is supposed to be a multiuser one.My problem is that i am being able to lock a table or record when two users write to the same table at the same time.I want to prompt one of the user that the table is in lock status.I have tried using the locktype, cursertype and curserlocation but still failed in acheiving the result.

thanks in advance for your help
 
Since Access locks by 1K page, you'll always end up in that situation in a multiuser Access based system. You can handle it by trapping the error code when executing the update. The error code you want to handle is 3164. I usually use a wait loop to try a few times before I give up - in the example below I try 6 times, waiting 10 seconds before trying to do the .Update.

Dim Retry_Count%
Retry_Count% = 0
On Error goto Error_Loop

Your update code here

Error_Loop:
select case err
case 3164
if Retry_Count% < 6
LoopTimer = time() + ((1/24/60/60) * 10)
While LoopTimer < Time
Doevents
wend
Retry_Count% = Retry_Count + 1
Resume
else
Msgbox Error$(Err)
Resume Somewhere_Else
endif
case else
Msgbox Error$(Err)
Resume Somewhere_Else
end select
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top