Refresh Main Form after Pop-Up Form Data Change

G

Guest

Dear Group
I have a main form [Inventory] that has an embedded subform called [Containers] and field called [ContainerType]. When you have the [Inventory] main form open and if a container is not in the list in the subform [Containers], the user can click a button to bring up a pop-up form [EditContainers] in which he or she can edit the "containers" table or add a new container. Sounds pretty straightforward. The button and pop-up work fine. When you add or edit the container through the pop-up, the pop-up is updated and displays properly. However, when I close the pop-up, the [ContainerType] field in the subform [Containers] on the main form [Inventory] is not updated with the new data unless I click refresh from the menu bar.

I've tried "Me.Refresh" on close for the pop-up to no avail. I also tried Me.Refresh on the main form [Inventory] and on the subform [Containers]for both the on focus and lost focus events to no avail. Lastly, I also tried "Forms![MainFormName].SubformControlName.Form.Requery" on the On-Close event for the pop-up. Can anyone help me? I'm not sure whether to add "refresh or requery" and I'm not sure which form to add them too, the main form [Inventory], the embedded subform [Containers] on the main form, or the pop-up [ContainerType]. Also, I'm not sure where to add it (After update, On Close, etc.). Any help for this newbie is greatly appreciated. Thanks group
 
E

estewart

try opening the pop-up form with the following line:

DoCmd.OpenForm "EditContainers", , , , , acDialog
me.requery

-----Original Message-----
Dear Group:
I have a main form [Inventory] that has an embedded
subform called [Containers] and field called
[ContainerType]. When you have the [Inventory] main form
open and if a container is not in the list in the subform
[Containers], the user can click a button to bring up a
pop-up form [EditContainers] in which he or she can edit
the "containers" table or add a new container. Sounds
pretty straightforward. The button and pop-up work fine.
When you add or edit the container through the pop-up, the
pop-up is updated and displays properly. However, when I
close the pop-up, the [ContainerType] field in the subform
[Containers] on the main form [Inventory] is not updated
with the new data unless I click refresh from the menu
bar.
I've tried "Me.Refresh" on close for the pop-up to no
avail. I also tried Me.Refresh on the main form
[Inventory] and on the subform [Containers]for both the on
focus and lost focus events to no avail. Lastly, I also
tried "Forms!
[MainFormName].SubformControlName.Form.Requery" on the On-
Close event for the pop-up. Can anyone help me? I'm not
sure whether to add "refresh or requery" and I'm not sure
which form to add them too, the main form [Inventory], the
embedded subform [Containers] on the main form, or the pop-
up [ContainerType]. Also, I'm not sure where to add it
(After update, On Close, etc.). Any help for this newbie
is greatly appreciated. Thanks group!
 
G

Guest

Thanks a million. It didn't work but it pointed me in the right direction. I simply set the field on the underlying form to "refresh" on got focus. Works beautiful!. Its interesting to note a MIcrosoft Glitch when I tried something else. I told underlying form to close on the click of the pop-up form. I then told the underlying form to open and requery when the pop-up form was closed. Kind of like a switch. It worked but guess what? The min and max buttons under the underlying form disappear! I was able to reproduce this consistantly. That's when I started looking for a different approach. Thanks a million

----- estewart wrote: ----

try opening the pop-up form with the following line:

DoCmd.OpenForm "EditContainers", , , , , acDialo
me.requer

-----Original Message----
Dear Group
I have a main form [Inventory] that has an embedded
subform called [Containers] and field called
[ContainerType]. When you have the [Inventory] main form
open and if a container is not in the list in the subform
[Containers], the user can click a button to bring up a
pop-up form [EditContainers] in which he or she can edit
the "containers" table or add a new container. Sounds
pretty straightforward. The button and pop-up work fine.
When you add or edit the container through the pop-up, the
pop-up is updated and displays properly. However, when I
close the pop-up, the [ContainerType] field in the subform
[Containers] on the main form [Inventory] is not updated
with the new data unless I click refresh from the menu
bar.avail. I also tried Me.Refresh on the main form
[Inventory] and on the subform [Containers]for both the on
focus and lost focus events to no avail. Lastly, I also
tried "Forms
[MainFormName].SubformControlName.Form.Requery" on the On
Close event for the pop-up. Can anyone help me? I'm not
sure whether to add "refresh or requery" and I'm not sure
which form to add them too, the main form [Inventory], the
embedded subform [Containers] on the main form, or the pop
up [ContainerType]. Also, I'm not sure where to add it
(After update, On Close, etc.). Any help for this newbie
is greatly appreciated. Thanks group
 

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