Telling users someone else is currently editing the record

johncassell

Well-known member
Joined
Jun 10, 2007
Messages
120
Location
Redcar, England
Programming Experience
Beginner
Hi there,

Hopefully this is posted in the right forum section..

I am looking for a way for my application to alert a user if someone else is currently editing a record.

I could probably work out a way but knowing me it wouldn't be the best way.

My application requires people to log in (Although I haven't yet set this up) and if someone goes in that record, a msgbox will appear saying "Record currently being edited by John"

Would the best way to do this be to create a table called 'Users' with two columns 'Name' and 'Status' and when people log in, I use an update command to add a value of 'LoggedIn' to the Status Column. This will also populate a label on my main form with their username.

Then when they go in a job, I do another update command to the 'Jobs' table and put their username in the 'LockedBy' column?

Or is there some magic way to achieve this?

Thanks

John
 
Hi there,

Hopefully this is posted in the right forum section..

I am looking for a way for my application to alert a user if someone else is currently editing a record.
You cant tell. Just because someone else recently downlaoded a record doesnt mean they are editing it. What we do is, using statemetns that do optimistic concurrency, is get an error is someone else edits a record while we had it. We can then decide whether to overwrite, revert or include their changes
Resolution is not automatic, only notification. TO be notified, ensure the "Use Optimisitc Concurrency" checkbox is clicked in the ADVANCED tab of your tableadapter config wizard

I could probably work out a way but knowing me it wouldn't be the best way.

My application requires people to log in (Although I haven't yet set this up) and if someone goes in that record, a msgbox will appear saying "Record currently being edited by John"

I'd do it like: standard checkin/checkout system:
Each table has a column CHECK_OUT (you called it LockedBy) which holds the user id of the user who checked that record out.
Viewing does not set the flag. Users can download for view any record or number of records.
When the user clicks EDIT button you must update the DB CHECK_OUT with that users id
When another user then clicks edit, the record is refreshed and if the CHECK_OUT column still has a user id in there, the message appears

Then when they go in a job, I do another update command to the 'Jobs' table and put their username in the 'LockedBy' column?

Just remember to separate viewing from editing
 
Back
Top