I have a continuous form based on a query. Here's what I'm seeking to accomplish.
I want the user to be able to scroll through the records and select any one for further processing via a check box. However sometimes a single record is part of a larger group and in that case I wanted to automate the process of selecting all the records within that group.
My original thought was to attach some code to the after update property of the check box that would capture the value of the check box and the id of the "grouped" field and then loop through the recordset assigning the value of the check box to the check boxes of all other records in the same group.
The code below works fine until it gets to the rst.edit command. Then I get "could not update locked by other process" error. Which makes sense I suppose as the form already has the same recordset open.
Is there a safe way around the locking problem or a better means of getting the same desired end result
Dim booRlBk As Boolean
Dim lngTxNum As Long
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
booRlBk = Me.RlBk
lngTxNum = Me.Transaction_Number
Set rst = dbs.OpenRecordset("Q_Transaction_History", dbOpenDynaset)
If Not (rst.EOF And rst.BOF) Then 'rst is not empty
rst.MoveFirst
Do Until rst.EOF = True
rst.FindNext "[Transaction Number] =" & lngTxNum
If rst.NoMatch Then
'Do Nothing
Else
Do While rst("[Transaction Number]").Value = lngTxNum
rst.Edit
rst("RlBk").Value = Me.RlBk
rst.Update
rst.MoveNext
Loop
End If
rst.MoveNext
Loop
End If
I want the user to be able to scroll through the records and select any one for further processing via a check box. However sometimes a single record is part of a larger group and in that case I wanted to automate the process of selecting all the records within that group.
My original thought was to attach some code to the after update property of the check box that would capture the value of the check box and the id of the "grouped" field and then loop through the recordset assigning the value of the check box to the check boxes of all other records in the same group.
The code below works fine until it gets to the rst.edit command. Then I get "could not update locked by other process" error. Which makes sense I suppose as the form already has the same recordset open.
Is there a safe way around the locking problem or a better means of getting the same desired end result
Dim booRlBk As Boolean
Dim lngTxNum As Long
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb
booRlBk = Me.RlBk
lngTxNum = Me.Transaction_Number
Set rst = dbs.OpenRecordset("Q_Transaction_History", dbOpenDynaset)
If Not (rst.EOF And rst.BOF) Then 'rst is not empty
rst.MoveFirst
Do Until rst.EOF = True
rst.FindNext "[Transaction Number] =" & lngTxNum
If rst.NoMatch Then
'Do Nothing
Else
Do While rst("[Transaction Number]").Value = lngTxNum
rst.Edit
rst("RlBk").Value = Me.RlBk
rst.Update
rst.MoveNext
Loop
End If
rst.MoveNext
Loop
End If