deleting related records

R

redFred

I have several subforms that are placed on tabs such that one subform is the
only one ever on the first tab, and other subforms are selected for the
second tab viewing based on the value of a control of the first tab's
subform.

I have a button on the first tab's subform that is intended to delete (quit,
abandon) the entry. I have used two methods:

DoCmd.RunSQL "DELETE [tbl 2 Job].* FROM [tbl 2 Job] Where [tbl 2 _
Job].InvNum = " & Me.InvNum

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

Each successfully deletes the record and, checking the tables, also the
related records.

So what's my issue?

When I click the button and delete the record and related, and then click on
the second tab, I can see the data that has been deleted, and Access thinks
its an orphan record without the required record (from first tab subform).

When I don't click on the second tab I can work normally until either
closing Access or taking a form into design mode (not something the user will
do, but the closing of Access they will).

I have requeried each and every form with the same results. "You cannot add
or change a record because one is required..."

The user may click on the second tab, but will always be closing the program
at some point. How do I clean this up?

Thanks.
 

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