Unable to delete from a form, because the record source is a query.

  • Thread starter Thread starter Andy Chicas
  • Start date Start date
A

Andy Chicas

Hello All,

I have a form that uses a query, qryProject, as its record
source.

When I use the delete function, it tells me that it cannot
delete because there are related records in tblProject.

Is there a way to delete this record in the form? When I
push the delete function, the record is deleted from
tblProject, etc.

Thanks for any feedback, and if you need me to clear
anything up, just tell me.

- Andy
 
Hello again,

I sort of solved my problem. I made it so that the delete
button would run a delete query. All seemed well, until...

When the delete query runs all of the fields come up
with "#deleted". I thought that maybe if I refreshed the
form that this would work, but I need to close the form
and then reopen it for that record to leave. Is there a
way to solve this problem?

Thanks for the help.

Andy
 
Is there a way to delete this record in the form? When I
push the delete function, the record is deleted from
tblProject, etc.

Open the Tables design window, and then the Relationships window.
Select the join line (or lines) from tblProjects to any tables related
"many" to tblProjects' "one". Check the "Cascade Deletes" option on
this relationship.

Warning: cascading deletes is powerful but thereby risky. You can
delete a whole LOT of records, possibly without intending to do so; if
you find later that you needed these records (say for historical
purposes, or for billing) too bad - they are gone forever and cannot
be recovered.
 
Back
Top