Use SQL to delete record from underlying query

J

JB

I have a form that is a main and subform. The subform uses dlookup to
find multiple values that are used as defaults for the current record.
This process is complex and ends up using code to modify bound fields.
This works great until I want to cancel the update.

If the user wants to add a record, this form is loaded and all of the
prior settings from the underlying tables are brought in. If I then
click Cancel to close the form and not complete the new entry, the
record is saved anyway. I understand why the record is saved by
Access.

I wanted to delete the just added record as a roundabout way to cancel
the add. If I go to the underlying query of the form, I can delete the
record manually or edit the record manually with no problem.

If I try to use SQL to delete the record, I can not. I get error 3028
can not delete from table or something like that. Even if I place the
SQL code in a standalone query for testing purposes, I can not use a
Delete query to remove the record. I know this overall appraoch is not
the best from a design perspective but I am working on someone else's
project and I just need to quickly fix what is not working with it.

Can anyone give me some advice?
 

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