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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Record Event Causes Warning

Status
Not open for further replies.

LJtechnical

Technical User
Aug 7, 2002
90
0
0
GB
Hi All,

I have a form with a subform. On the main form I have delete button which runs an on click event as follows:

a delete query to delete the asociated records of the subform.

Select and Delete main record.

Now this all seems to work fine but after the event has completed I get a message saying Microsoft cannot find "|" field etc. I cannot see what is causing it, might well be another query that runs after screen is refreshed but I can't see why.

Any ideas?

Thanks
 
Most likely you have deleted a record that was the current record of either your main form or your subform.

As a test you could:
1. Place a breakpoint in the code and step through it. Do you still get the error? If so, where?
2. add code just before the delete query that sets the record source for the subform to empty, then sets the main form record source to empty. This may cause other errors depending on ehatever code you may have that runs after the delete.


"Have a great day today and a better day tomorrow!
 
I think you have hit upon the problem, though it seems strange to me. It is the main form that is causing the warning the delete query works fine and produces no errors.

For the main form record I have used both

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

And

DoCmd.DoMenuItem acFormBar, acEditMenu, acSelectRecord, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, acDelete, , acMenuVer70

As the latter supposedly does what the user can do through the Menu Options I am surprised that it produces this warning when manually deleting doesnt.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top