sunilvedula
Sunil
- Local time
- Tomorrow, 03:38
- Joined
- Jan 18, 2007
- Messages
- 138
Hi All,
My database contains records with unique ID's . they can have account number repeating. i have a button which they click they get 1 record and it checks the account number if it has repeated and has not been resolved (identified by a status col) it will need to throw all of them to the same user. My problem is it does throw up but when multiple users click (approx 15 users) some users are getting the same records for multiple users. i am attaching the code i have written. Can anyone suggest a better way so that it does not show the same records to another user after it has been allocated to one.
My database contains records with unique ID's . they can have account number repeating. i have a button which they click they get 1 record and it checks the account number if it has repeated and has not been resolved (identified by a status col) it will need to throw all of them to the same user. My problem is it does throw up but when multiple users click (approx 15 users) some users are getting the same records for multiple users. i am attaching the code i have written. Can anyone suggest a better way so that it does not show the same records to another user after it has been allocated to one.
Code:
'***** Loop for getting 1 case from the queue specified *******'
DoCmd.SetWarnings False
DoCmd.RunSQL "update TblWork set TblWork.EmpID = '" & Me.LblUserID.Caption & "' " & _
"where TblWork.ID in (select Top 1 TblWork.ID from TblWork where TblWork.Queue = '" & VQ & "' and TblWork.EmpID IS NULL ORDER BY TblWork.SLA, Tblwork.Reportdt, TblWork.Amt, TblWork.Cardnumber);"
DoCmd.SetWarnings True
'**** passing the variable to check for multiple transactions for the same account ****'
VACCT = DLookup("[Cardnumber]", "[qCheckSameAcctFQ]")
'**** CHEKCING FOR MULTIPLE ACCOUNTS****'
Do Until (IsNull(DLookup("[Acct]", "qSameAcct2FQ")) Or DLookup("[Acct]", "qSameAcct2FQ") = "")
Check = DLookup("[Acct]", "qSameAcct2FQ")
DoCmd.SetWarnings False
DoCmd.RunSQL "Update TblWork set TblWork.EmpID = '" & Me.LblUserID.Caption & "', TblWork.Inputdt = '" & Now & "', TblWork.Status = null WHERE TblWork.ID = " & Check & ";"
DoCmd.SetWarnings True
Me.LstInbox.SetFocus
Me.LstInbox.Requery
Loop