Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application closes when deleting a record

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, i have a form with a child subform, and a delete image in the main form for deleting the main record. When i have added the first record in the child form, if i click the delete image the DB closes, and i have tested that it occurs when, after deleting, the main form goes to another record with a Me.Requery or DoCmd.GoToRecord statements, appearing the alert "The record has been eliminated".

It doesn't happen when i have added two records in the child form instead of one, or if after having added the record in the child form i browse to another record in the main form and come back before deleting the main record.

Thanks for any help given.
 
Thanks SeeThru. Yes, there's an image for deleting the main record. The code in the OnClick event is:

Application.SetOption "Confirm Action Queries", 0
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Application.SetOption "Confirm Action Queries", 1
Me.Requery
 
I think I know what <b>may</b> be happening.

If there is just one record, and you delete it, your form in requeried.

There may well be some code in the form that checks for having no records, and if there are no records, closes the form. I suspect thiat this is running incorrectly and closing the entire database.

Check the code anywhere on the form for 'docmd.close'. Try commenting this out, or adding a debug pause to see what is triggering it.

SeeThru
Synergy Connections Ltd - Telemarketing Services
 
Thanks SeeThru.

The problem was in a second subform related to the first one, i have solved it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top