M
MDW
I'm working on a split DB with a bond form on the f/e. Users will not be
adding records; they will only be editing them.
I want to set it up so that if one person has a record up on their form
(even if they haven't typed or edited anything), anyone else who opens the
f/e on their side will not see that record.
Here's the code I have on the form. Explanation of problem below.
Private Sub Form_Current()
Dim objRS As DAO.Recordset
' Get a copy of the current recordset
Set objRS = Me.RecordsetClone
' Move to the first unlocked record
Do Until Me.RowLocked = False
DoCmd.GoToRecord , , acNext
' Keep the clone in sync with the current record
objRS.Bookmark = Me.Bookmark
If objRS.EOF Then ' We're on the last record
MsgBox "No available records at this time!", vbExclamation
Exit Do
End If
Loop
' Force the recordset to appear as being edited
Set objRS = Me.Recordset
objRS.Bookmark = Me.Bookmark
objRS.Edit
txtVALIDATED_AMOUNT.SetFocus
End Sub
Property Get RowLocked() As Boolean
' ********************************************************************
' This property detects whether the current record on a form is locked
' ********************************************************************
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
On Error Resume Next
rs.Edit
RowLocked = (Err.Number <> 0)
rs.CancelUpdate
Err.Clear
On Error GoTo 0
Set rs = Nothing
End Property
OK, when the first person opens the form to the first record. It opens fine.
While the first person remains on the first record, no one else can open the
form on their local f/e. It just hangs. Once the first person moves to the
next record, other people can open the form, but it just keeps cycling
through all the records as though each of them are locked.
Believe me, I've checked that the DB and the form are set to record-level
locking.
Any thoughts?
adding records; they will only be editing them.
I want to set it up so that if one person has a record up on their form
(even if they haven't typed or edited anything), anyone else who opens the
f/e on their side will not see that record.
Here's the code I have on the form. Explanation of problem below.
Private Sub Form_Current()
Dim objRS As DAO.Recordset
' Get a copy of the current recordset
Set objRS = Me.RecordsetClone
' Move to the first unlocked record
Do Until Me.RowLocked = False
DoCmd.GoToRecord , , acNext
' Keep the clone in sync with the current record
objRS.Bookmark = Me.Bookmark
If objRS.EOF Then ' We're on the last record
MsgBox "No available records at this time!", vbExclamation
Exit Do
End If
Loop
' Force the recordset to appear as being edited
Set objRS = Me.Recordset
objRS.Bookmark = Me.Bookmark
objRS.Edit
txtVALIDATED_AMOUNT.SetFocus
End Sub
Property Get RowLocked() As Boolean
' ********************************************************************
' This property detects whether the current record on a form is locked
' ********************************************************************
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
On Error Resume Next
rs.Edit
RowLocked = (Err.Number <> 0)
rs.CancelUpdate
Err.Clear
On Error GoTo 0
Set rs = Nothing
End Property
OK, when the first person opens the form to the first record. It opens fine.
While the first person remains on the first record, no one else can open the
form on their local f/e. It just hangs. Once the first person moves to the
next record, other people can open the form, but it just keeps cycling
through all the records as though each of them are locked.
Believe me, I've checked that the DB and the form are set to record-level
locking.
Any thoughts?