Consonanza
New member
- Local time
- Today, 21:41
- Joined
- Jan 7, 2022
- Messages
- 11
I am using the code below attached to a command button in my form header. Its purpose is to toggle the button's caption between SELECT and DESELECT to enable me to select all or specific records for a subsequent action.
The toggling works fine if I want to select/deselect ALL records. However if I select specific records then decide to select/deselect all, I get the error:
Write conflict:
Save record/Copy to clipboard/Drop changes
and then:
Error 3021: No current record in procedure cmdSelect_click, line 120.
It's not a show stopper but just a nuisance. How can I avoid the error?
The toggling works fine if I want to select/deselect ALL records. However if I select specific records then decide to select/deselect all, I get the error:
Write conflict:
Save record/Copy to clipboard/Drop changes
and then:
Error 3021: No current record in procedure cmdSelect_click, line 120.
It's not a show stopper but just a nuisance. How can I avoid the error?
30 Select Case Me!cmdSelect.Caption
Case Is = "Deselect"
'Set to to False all records in the target disc
40 strSQL = "UPDATE tblTempReplaceData SET tblTempReplaceData.fldCheckSelect = False Where tblTempReplaceData.fldDiscID_A = " & TempVars!TargetDiscID
50 CurrentDb.Execute strSQL, dbFailOnError
60 Me!cmdSelect.Caption = "Select"
70 Case Is = "Select"
'Set to to True all records in the target disc
80 strSQL = "UPDATE tblTempReplaceData SET tblTempReplaceData.fldCheckSelect = True Where tblTempReplaceData.fldDiscID_A = " & TempVars!TargetDiscID
90 CurrentDb.Execute strSQL, dbFailOnError
100 Me!cmdSelect.Caption = "Deselect"
110 End Select
120 Form.Refresh