Detecting record locking in mult user environment

T

Toad62

Hi all,

I need to display a more meaningful message when a user tries to edit a
record currently being edited by another user in a multi user setup.

We don't have Record Selectors that would normally show the ghost buster
symbol, and all the user gets is a beep - but with no indication as to what
caused it.

Any help would be greatly appreciated.

Ta

Phill
 
D

Dale Fye

Phill,

Since no one else jumped in. I'll give it a stab.

The way I've been doing it lately is to add a LockedBy field to the main
tables (all of the ones that are the basis for forms) in my database.

Then, in all of my main forms, I add some code to the Current event that
checks to see if that field is NULL. If not, I display a message advising
the user that the record is locked, then I lock all of the controls using
code you can find on Allen Browne's website at
(http://www.allenbrowne.com/ser-56.html). If it is null, then I write the
users windows userid (http://www.mvps.org/access/api/api0008.htm ) to that
field, and save the record, then I unlock all of the controls.

Lastly, I replace the built-in navigation buttons with a set of my own so
that I can reset the LockedBy field to NULL before moving to another record.

HTH
Dale
 
T

Toad62

Thanks for you reply Dale,

I was hoping there would be an easier way!

Best regards

Phill
 
D

Dale Fye

I was too. It took some playing around, but I finally got it to work. The
key was the custom navigation buttons, because there is no event that fires
when you click on the built in nav buttons, before leaving the current record
(unless that record has changed). BeforeUpdate works is the record has
changed, but not if it hasn't.

I tried waiting until the form was dirty before locking it down, but then I
couldn't set the LockedBy field without saving the record, and screwing up
the users ability to cancel his/her changes.

I thought I had seen some discussion about custom navigation buttons a while
back. One of the MVPs had posted that they have a nav button form that they
install as subform in their forms footers, but I was unable to find the post
when I looked last night. You might want to do a google search to see if you
can find that.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 

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