Locking seem does not work.

S

S.L.

I use AccessXP in .mdb format.

I testing locking by create 2 identical forms. When click button, it run the
following code and wait until I click another button to set mkLock to True
to perform .Update method and then close everything.

mkLock = True
Set wkDB = CurrentDb
Set wkRS = wkDB.OpenRecordset("select * from MTR1 where MTR1_CD = 'A' ")
wkRS.Edit
wkRS!MTR1_No = wkRS!MTR1_No + 1
Do While mkLock
DoEvents
Loop
wkRS.Update
wkRS.Close: Set wkRS = Nothing
wkDB.Close: Set wkDB = Nothing

Problem is when the first form looping in Do...Loop then I start a second
form and run it. What I expect is the second form will display error message
at line wkRS.Edit. But it does not ? Access help file explain that
..OpenRecordset will open (by default) as Dynaset and use Pessimistic
locking. However, If I open MTR1, table is locked for read only.

Help please
 

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