Record Locking

F

FL1

Hi all,

I have a split database and have a bound form that displays a records from
the BE database allowing users to edit the record. I am trying to write some
logic to prevent 2 users from calling up the same record at the same time.

I am using the following code to lock the recordset:

mySQLStr = "SELECT * FROM statusByBranch WHERE stocktakeNumber = " +
Str(Me.orderNo_txt) + " AND warehouse = '" + Me.warehouse_txt + "'"

Set myLock = CurrentDb.OpenRecordset(mySQLStr, dbOpenDynaset)
myLock.LockEdits = True
myLock.Edit

But instead of only locking the records within the resulting recordset it
seems as though Access locks the entire table (statusByBranch), resulting in
other users getting an error 3260 (Could not update; currently locked by user
<user> on machine <machinename>). Is there a way form me to lock a specific
record or records rather than an entire table?

I have done a fair bit of reading and have tried to play with the locking
settings but to no avail. My database is current set to enable record-level
locking but that does not seem to make any difference.

Any help would be greatly appreciated. THANKS in advance.

FL
 

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