Deleting records on a subform

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
 
R

Rick B

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.
 
D

DS

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
 
D

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top