How to go to next unlocked record

sudhirhinduja

Registered User.
Local time
Today, 06:15
Joined
Aug 17, 2004
Messages
41
Hi,

I have implemented an editable multi-user database which has no additions/deletions to it. It has a form based off a query.That form has a button NextToDo. On clicking this button, a macro starts which runs a requery as the first step and gotoRecord Next as the second step.

Problem is many times two or more users are opening the same record. So I need some way to goto the next unlocked record.

I tried putting a dummy checkbox and setting it to Yes in the form's onCurrent event but I'm not sure why it's not working.

Please help.

Thanks,
Sudhir.
 
Try updating the record and if it's locked it'll generate an error. Trap that error and go to the next record. Error Number 3186 indicates 'couldn't save' locked by another user. Error Number 3260 indicates 'couldn't update' locked by another user.

Otherwise, utilize CommitTrans/Rollback logic which you need to look up.
 
Hi

Hi llkhoutx,

I'm relatively new to VBA. I know I have to use recordsets and the lockedits property from what you suggested and what I've read on Access help and a couple of others.

I just dont know how to go about it.

I am thinking on a couple of lines

1. I set the recordset to the form. I check on form open event if the lockedits is true? If true goto next record. If not I open the record and allowedits. My question is won't every new opened form set itself to lockedits=True?

2. I set the recordset to the query. Since I am requerying every time he NextToDo button is clicked, the recordset gets automatically modified?

Please help.

Thanks,
Sudhir.

llkhoutx said:
Try updating the record and if it's locked it'll generate an error. Trap that error and go to the next record. Error Number 3186 indicates 'couldn't save' locked by another user. Error Number 3260 indicates 'couldn't update' locked by another user.

Otherwise, utilize CommitTrans/Rollback logic which you need to look up.
 

Users who are viewing this thread

Back
Top Bottom