Allow Opening of one single record at a time.

AaronWard

New member
Local time
Today, 14:00
Joined
Sep 20, 2010
Messages
7
Here is my vba code:



strSQL = "SELECT TOP 1 [Account Number]
FROM LiveData
WHERE WorkingRep Is Null And Priority In (1);"
Set rst1 = New ADODB.Recordset
With rst1
Debug.Print .State
.Open strSQL, CurrentProject.Connection, adOpenForwardOnly, adLockOptimistic
Debug.Print .State
Me.txtAccountNumber = .Fields(0)

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE LiveData SET WorkingRep = '" & VZID & "' WHERE [Account Number] = " & Me.txtAccountNumber & ";"
Me.txtAccountTime.Value = Now()
DoCmd.SetWarnings True

.Close
End With



My database has multiple users accessing the account numbers - most of which are all at the same time. How can i grab the account number and prevent another user from accessing this record?
 

Users who are viewing this thread

Back
Top Bottom