If you are using a subform, then the records that are being displayed are
normally filtered by some value (or values) on the main form.
If you can grab that value you should be able to write a delete query that
will delete all the relevant records in the subform.
strSQL = "DELETE FROM [TheSubFormTable] WHERE [TheSubFormTable].[SomeField] "
& TheValueFromTheMainForm
Currentdb().Execute strSQL
I would be sure to backup and test first to make sure this works as expected.
Another alternative would be to build and store a delete query that references
a control on the parent form that has the value. And then execute that stored
query.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Thanks John,
This is a report that is not big enough to worry about having to re-do, I
have put a control button to delete record and it works fine but only deletes
one line at a time,can i change that control to delete the entire sheet at
once?
.