Subform not refreshing on when deleting a record.

binbin

Registered User.
Local time
Tomorrow, 03:15
Joined
Sep 3, 2012
Messages
53
Hi everyone!

This has stomped me. I have a mainform that has 2 subforms (Subform A and Subform B). "SubformA" lets the user add and delete records in datasheet view, while SubformB serves as a summary total of the records that have been added, and is locked. I have made an after update event to requery "SubformB" using the following code:

Me.Parent.SubformB.Requery

I also put that code on the "on delete" event of "SubformA." After I add or edit a record, "SubformB" reflects the changes. However, when I delete records using "SubformA," the results is not reflected on "SubformB," I have to click on any field on "SubformB" and press "F5" to refresh "SubformB." This is driving me crazy. Any help would really be appreciated.

Also, "SubformB" has a recordsource of a sum query of a union query.

Thanks!

PS: Changed the code.
 
Last edited:
I dont know your mdb, but I think you don't need Subform B.
Put all in Subform A.
 
Hi MStef,

"SubformB" is needed since my "SubformA" does not display all underlying items because I have a group of items that make up an item. "SubformB" displays all these underlying items and groups them together to get the total quantity added in "SubformA."

What I would like to do is "instantaneously" update "SubformB" upon addition, edit and delete of records on "SubformA."

I have done requery on after update and on delete event of "SubformA," however, only the after update event works. So what I do is go to "SubformB" and press "F5" to refresh it.

Update: I have added another event procedure on the "after delete confirm" event of "SubformA." So when I try and delete a record on "SubformA," right after the delete prompt, "SubformB" now updates. It's close to what I want but not quite, I want to eat my cake too :D I would still like to find out why the requery code only works on after update and after delete confirm event and not on the on delete event???

Thanks.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom