Deleting records on a subform

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

If you enter records on a subform, and you hit cancel on the main form
is there a way to undo the records, or get rid of the records on the
subform?
Thanks
DS
 
I would not think so, since they are already saved.

You could build code, but you would have to know which records were added
this time.
 
Rick said:
I would not think so, since they are already saved.

You could build code, but you would have to know which records were added
this time.
I'd only have delete the records that are showing. The main form has a
salesID and the subform contains the payments, so everytime the main
form comes up the subform is empty, so I would just be deleting the
record or records that were currently added, so the next time I open
that SalesID it would have no payments or records attached to it.
Thanks
DS
 
DS said:
I'd only have delete the records that are showing. The main form has a
salesID and the subform contains the payments, so everytime the main
form comes up the subform is empty, so I would just be deleting the
record or records that were currently added, so the next time I open
that SalesID it would have no payments or records attached to it.
Thanks
DS
This works.....A Loop Satement.

Private Sub Cancel_Click()
DoCmd.GoToControl "PaymentSubform"
With Forms!Payment.PaymentSubform.Form.RecordsetClone
.MoveFirst
Do While .EOF = False
.Delete
.MoveNext
Loop
End With

DoCmd.Close acForm, "Payment", acSaveNo
DoCmd.OpenForm "LogOn"
End Sub

DS
 
Back
Top