V
Vic
Hello,
I have a continuous form and I'm having a problem deleting like 1 out of
several records selected. If I delete everything selected it works fine.
However, if I select 2 records and then reply yes to 1 and NO to the other
neither record is deleted. My messages displayed indicated that it worked
correctly but if I cancel 1 then both are canceled. Of course this only
occurs on multiple record selected not when only 1 record is to be deleted.
I am creating an array of the record codes that are selected for delete in
the Delete event and then in the BeforeDelConfirm event it uses the array to
confirm each record for delete. Seems pretty straight forward but doesn't
work for me and I would really appreciate some insight into this.
Thank you very much!
Vic
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Dim resp As Long
For i = 0 To itemsDeleted - 1
resp = MsgBox("Do you want to delete fee code: " & strFeeCode(i),
vbYesNo, "Show Secretary")
If resp = vbNo Then
MsgBox strFeeCode(i) & " NOT Deleted", vbInformation, "Show
Secretary"
Cancel = True
Else
MsgBox strFeeCode(i) & " Deleted", vbInformation, "Show
Secretary"
End If
Next i
End Sub
Private Sub Form_Delete(Cancel As Integer)
strFeeCode(i) = Me.Fee_Id
i = i + 1
itemsDeleted = i
End Sub
I have a continuous form and I'm having a problem deleting like 1 out of
several records selected. If I delete everything selected it works fine.
However, if I select 2 records and then reply yes to 1 and NO to the other
neither record is deleted. My messages displayed indicated that it worked
correctly but if I cancel 1 then both are canceled. Of course this only
occurs on multiple record selected not when only 1 record is to be deleted.
I am creating an array of the record codes that are selected for delete in
the Delete event and then in the BeforeDelConfirm event it uses the array to
confirm each record for delete. Seems pretty straight forward but doesn't
work for me and I would really appreciate some insight into this.
Thank you very much!
Vic
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Dim resp As Long
For i = 0 To itemsDeleted - 1
resp = MsgBox("Do you want to delete fee code: " & strFeeCode(i),
vbYesNo, "Show Secretary")
If resp = vbNo Then
MsgBox strFeeCode(i) & " NOT Deleted", vbInformation, "Show
Secretary"
Cancel = True
Else
MsgBox strFeeCode(i) & " Deleted", vbInformation, "Show
Secretary"
End If
Next i
End Sub
Private Sub Form_Delete(Cancel As Integer)
strFeeCode(i) = Me.Fee_Id
i = i + 1
itemsDeleted = i
End Sub