From: Ramses on
Greetings all,

I am revisiting some sharp edges in a project I mostly completed last
year. I thank you for any assistance you can provide a novice Access
guy.

First off, I want to have a popup form refresh the underlying record
source in an already-open subform after a new record is entered (using
the popup form). I have this working using Forms!MainForm!
subForm.Form!Control.requery firing on the popup's On Close event.

However, since the popup and its code can be called from different
forms, I'd like to use OpenArgs to pass the calling form/subform/
control to the popup's On Close code. But simply passing "Forms!
MainForm!subForm.Form!Control" as the OpenArgs text, then calling
Me.OpenArgs.requery in the popup's event does not work. I know this
is a syntax issue, but I've tried a lot of alternative ways to
reformat the addressing of the form/subform/control to no avail. I
haven't found any examples of addressing form/subform/control in the
fashion of Forms(MainForm).Controls(Control), which seems like it is
probably the key.

Thanks very much for any help or examples.
From: Jon Lewis on
Would the pop-up be called from main forms or the relevant Sub forms or
both?
Do you really need to requery a control on the subform as opposed to form
itself?

Jon


"Ramses" <srmichalak(a)gmail.com> wrote in message
news:8acb635b-569f-4695-9099-1c2c28ffe421(a)b21g2000vbh.googlegroups.com...
> Greetings all,
>
> I am revisiting some sharp edges in a project I mostly completed last
> year. I thank you for any assistance you can provide a novice Access
> guy.
>
> First off, I want to have a popup form refresh the underlying record
> source in an already-open subform after a new record is entered (using
> the popup form). I have this working using Forms!MainForm!
> subForm.Form!Control.requery firing on the popup's On Close event.
>
> However, since the popup and its code can be called from different
> forms, I'd like to use OpenArgs to pass the calling form/subform/
> control to the popup's On Close code. But simply passing "Forms!
> MainForm!subForm.Form!Control" as the OpenArgs text, then calling
> Me.OpenArgs.requery in the popup's event does not work. I know this
> is a syntax issue, but I've tried a lot of alternative ways to
> reformat the addressing of the form/subform/control to no avail. I
> haven't found any examples of addressing form/subform/control in the
> fashion of Forms(MainForm).Controls(Control), which seems like it is
> probably the key.
>
> Thanks very much for any help or examples.


From: Ramses on
Jon,

The popup in question is called from the subform, but I would like to
know how to do it either way. Yes, I want to requery the control's
record source specifically rather than the form or subform because the
popup is likely to be called while a subform record is in the process
of being entered.

Do I take it from your questions that passing the full reference to a
control on a subform on a form with OpenArgs and then applying the
requery method to it in a called procedure is not possible?

Thanks for your reply.


On Jun 3, 6:38 am, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com>
wrote:
> Would the pop-up be called from main forms or the relevant Sub forms or
> both?
> Do you really need to requery a control on the subform as opposed to form
> itself?
>
> Jon
From: Jon Lewis on
An easier way would be to open your pop-up form in windows mode dialog e.g.
DoCmd.OpenForm "frmAddRecord", , , , , acDialog

This suspends code in the calling procedure until the pop-up is either
closed or made invisible. So the usual technique is to have Cancel and Save
buttons on the pop-up. Cancel will Undo changes and Close the pop-up. Save
will Save the record and set Visible = False for the pop-up.

Code execution will then continue in the calling procedure at which point
you test if the pop-up is still loaded (Google for the well documentated
IsLoaded function for forms). If this returns true you know that Save was
chosen so the calling procedure can do the requery and then Close the
pop-up.

HTH

Jon






"Ramses" <srmichalak(a)gmail.com> wrote in message
news:792748d6-2de2-4412-a511-ecabc62c47ce(a)o1g2000vbe.googlegroups.com...
Jon,

The popup in question is called from the subform, but I would like to
know how to do it either way. Yes, I want to requery the control's
record source specifically rather than the form or subform because the
popup is likely to be called while a subform record is in the process
of being entered.

Do I take it from your questions that passing the full reference to a
control on a subform on a form with OpenArgs and then applying the
requery method to it in a called procedure is not possible?

Thanks for your reply.


On Jun 3, 6:38 am, "Jon Lewis" <jon.le...(a)cutthespambtinternet.com>
wrote:
> Would the pop-up be called from main forms or the relevant Sub forms or
> both?
> Do you really need to requery a control on the subform as opposed to form
> itself?
>
> Jon