I'm sure this is very simple to do but how would I delete a series of related records from a recordset. For instance, all the records that belong to a certain customer? I have entered the following code so far but the code keeps hanging as if it's stuck in a loop.
If MsgBox("Do You Want To Delete The Record?", 4, "Deletion?"
= 6 Then
Set dbs = CurrentDb
Set MyRs = dbs.OpenRecordset("ClientNotes", dbOpenDynaset)
strCriteria = "[CustID]= " & (Me!CustID) & ""
MyRs.MoveFirst
MyRs.FindFirst strCriteria
If MyRs.NoMatch Then
Me.Text24 = ""
Me.List1 = ""
Else
MyRs.Delete
Do Until MyRs.EOF
MyRs.FindNext strCriteria
If MyRs.NoMatch Then
Me.Text24 = ""
Me.List1 = ""
Else
MyRs.Delete
End If
Loop
MyRs.Close
End If
If MsgBox("Do You Want To Delete The Record?", 4, "Deletion?"
Set dbs = CurrentDb
Set MyRs = dbs.OpenRecordset("ClientNotes", dbOpenDynaset)
strCriteria = "[CustID]= " & (Me!CustID) & ""
MyRs.MoveFirst
MyRs.FindFirst strCriteria
If MyRs.NoMatch Then
Me.Text24 = ""
Me.List1 = ""
Else
MyRs.Delete
Do Until MyRs.EOF
MyRs.FindNext strCriteria
If MyRs.NoMatch Then
Me.Text24 = ""
Me.List1 = ""
Else
MyRs.Delete
End If
Loop
MyRs.Close
End If