delete code, subform

G

Guest

I use a button on my form to add a record and a quit button for the user to
abandon the entry.
The form has a subform with cascading updates and deletes and a one-to-one
relationship. Each form
is bound to its own table.

The add button code:

Me.AllowAdditions = True
Me.AllowDeletions = True
Me.BCfrm.Form.AllowAdditions = True 'BCfrm is the subform
Me.BCfrm.Form.AllowDeletions = True
DoCmd.GoToRecord , , acNewRec

I add a new record fine.

The quit button code:

'allows each form to delete the record from their table.
Me.AllowDeletions = True
Me.BCfrm.Form.AllowDeletions = True

'turns off system messages
DoCmd.SetWarnings False

'deletes [tbl2Job] record and [tbl2VisitsBC] record.
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70


'turns system messages back on
DoCmd.SetWarnings True
Me.AllowDeletions = False
me.AllowAdditions=False
Me.BCfrm.Form.AllowDeletions = False
Me.BCfrm.Form.AllowDeletions = False

Problem: I cannot get this button code to delete the in-process record and
its associated record in the subform.
Before the inclusion of the subform (just one form) the record deleted fine.
I suspect that the
issue is the record in the subform, but do not have the requisite skills to
figure this out.

Will someone take pity on me?
 
G

Guest

After much frustration, I determined that I was deleting before an associated
record was in th subform. Now -- all is good.
 

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