Can't seem to requery a subform from another form. (1 Viewer)

Lkwdmntr

Registered User.
Local time
Today, 04:49
Joined
Jul 10, 2019
Messages
277
Hello, I can't seem to get this right. I have searched online and nothing seems to work. I have a main form with two subforms. One of the subforms is a list that when I hit a button I can add new records to it with a nice data entry form that pops up. You can still see the original list and I was hoping that when I hit "Add Another" button it would requery the subform and I can see the updated data with the popup still open. I attached a screenshot and the form in the background is "frmselectWeektoCreateMealPlan" the subform with the list on it is "frmPersonalFoodItems_subf" and the popup form is "frmAddNewPersonalItem". I hope someone has a better option then this (Forms!frmselectWeektoCreateMealPlan.frmPersonalFoodItems_subf.Form.Requery) which I tried and didn't work.
 

Attachments

  • foodlist.PNG
    foodlist.PNG
    62.1 KB · Views: 104

MajP

You've got your good things, and you've got mine.
Local time
Today, 07:49
Joined
May 21, 2018
Messages
8,525
Forms!frmselectWeektoCreateMealPlan.frmPersonalFoodItems_subf.Form.Requery
The problem may be how you call the pop up. If in the Docmd you do not use ACDIALOG then your code in the calling form will run immediately and the requery occurs before you do anything in the pop up. Acdialog argument will stop code execution until you close the pop up.

This will not work because the requery happens immediately, not when the pop up closes.
Code:
Docmd.openform "frmPopUp"
Forms!frmselectWeektoCreateMealPlan.frmPersonalFoodItems_subf.Form.Requery

The description is incomplete
It is more than just setting the pop up to modal and Pop us. It halts code execution in the calling form.
 

Lkwdmntr

Registered User.
Local time
Today, 04:49
Joined
Jul 10, 2019
Messages
277
Forms!frmselectWeektoCreateMealPlan.frmPersonalFoodItems_subf.Form.Requery
The problem may be how you call the pop up. If in the Docmd you do not use ACDIALOG then your code in the calling form will run immediately and the requery occurs before you do anything in the pop up. Acdialog argument will stop code execution until you close the pop up.

This will not work because the requery happens immediately, not when the pop up closes.
Code:
Docmd.openform "frmPopUp"
Forms!frmselectWeektoCreateMealPlan.frmPersonalFoodItems_subf.Form.Requery

The description is incomplete
It is more than just setting the pop up to modal and Pop us. It halts code execution in the calling form.
Thanks, but I played around with it and got it to work. This is what I ended up with.
[Forms]![frmSelectWeektoCreateMealPlan].[Form]![frmPersonalFoodItems_subf].Requery

Works great. I can see the changes as I enter the data in the other form. Thanks for responding.
 

Users who are viewing this thread

Top Bottom