record locks

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I have a db with a couple forms. I want to users to be able to open and
modify entries anytime, and yet not to modify the same record at the same
time (some kind of lock when a record is being editing, release the lock soon
as the 1st user is done editing the record.
what kind of locking is that? would that be edited record (will that lock
EVERYTHING that's been edited)?


Thx
 
This will happen by default (if you change a record that someone else
changed, you will get an error). Now if you want to avoid that error, you
can make it where the second user can't even get in an "in use" record.
Tools/OptionsAdvanced/Default Record Locking:Edited Record.

Personally, I have never set this up and have very very rarely run into
issues. This may be different for your application if you often have users
trying to CHANGE the same record.
 
Jeff

Problably a bit late in the day looking at the posting date, but a technique
I have used in the past is as follows:

1. Ensure that the table has a Timestamp field (Date/Time) which always
defaults to Now() on create
2. Whenever a form modifies a record, ensure that the timestamp field is
updated to now()

Now when a form gets the current record (either on then open or on current
event), capture the value of the timestamp. Then just before the update
happens check back on the record to see if the timestamp has changed
SQL query something like:

select count(*) from table_being_edited
where primary_key = your_primary_key
and timestamp = your_stored_timestamp on open/current


Now, if you get a count of zero back - the record has changed and you can
cancel the update with a nice message. If you get 1 back, then you are okay
to update

HTH
Chris
 
Back
Top