Locking a record/form

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

Guest

Hi all,

I have a database with FE and BE and about 20 users are about to start using
the DB. Now They are going to go in a shared database and start calling
customers.
But I donät want them to call the same customer at the same time.
So, my question, how to keep user2 out of a filtered form if user 1 is
already in it.

Is there a code that says if this record is opened by someone, lock it ?
What options do I have ?

Thanks
 
Access does not expose this functionality to you.

If it is important, you could create a table with fields:
UserID Text which user is viewing this record.
ID Number primary key of the record being viewed
LockTime Date/Time when the user locked this record.

You could then write a record to this table whenever a user views a record,
and remove the record when the user has finished with the the record. You
would need one such table for each table in your database that needs this
kind of functionality (to prevent hitting one monster table with constant
locks and unlocks.)

Then in the Current event of a form, you could DLookup() the locking table
to see if the record is there, and if so take the appropriate action.

To cope with failed writes or crashes, you would also need some kind of
maintenance routine to clear all a user's "locks", remembering to handle the
case where one user could have multiple instances of the database open on
one machine or on different machines.

I doubt that the effort invovled would prove productive.
 
Back
Top