View Single Post
  #1 (permalink)  
Old December 6th, 2004, 08:29 AM
cbtoolkit cbtoolkit is offline
Registered User
 
Join Date: Dec 2004
Location: Cave Creek, AZ, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Record locking - user needs the next queued record

Thanks for any direction on this...

I have an Access front-end (project .adp file) accessing a SQL back-end DB. The data is a basic call list for a credit/collection center.

Callers are in various "call groups" that bring up records based on various criteria - regional, dollar amount owed, etc. The queues are not necessarily mutually exclusive - meaning records in one queue can possibly show up in another queue.

I do the above with simple views that query the unviewed/uncalled records. After a record is contacted, it drops from the list.

I need a way to ensure that when someone opens a record, no one else can open that record. Here is the process.

User clicks a "Next Record" button.

I have a function called "GetNextRecord" that performs the query based on their call group. The query includes the top 25 records based on the criteria (just to reduce the queries overall size). The next unique key is returned and then back on my Access form I set my recordset to that unique key.

AT the time the form is opened, the record is "stamped" for the user who opened the form. At this point, the record drops off the queue because all the views exclude records with a user code saved to them.

However, if two users simultaneously hit next record, they can grab the unique key prior to the record being stamped.

How do I remedy this. Can I do it at the query prior to returning the record number. For instance, using the following:

Open the query so that a record can be updated - returning 25-50 records.
Starting at the first record, stamp the record for that user if it hasn't already been stamped. Return the number.

If it has been stamped in the time that they created/pulled the query, move to the next record in the recordset and try the same.

I hope this made sense. Your input is greatly appreciated.

Matthew Moran
The IT Career Builder's Toolkit
http://www.cbtoolkit.com
Reply With Quote