dbTalk Databases Forums  

OpenArgs passing form/subform/control and using to requery?

comp.databases.ms-access comp.databases.ms-access


Discuss OpenArgs passing form/subform/control and using to requery? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ramses
 
Posts: n/a

Default OpenArgs passing form/subform/control and using to requery? - 06-02-2010 , 05:03 PM






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.

Reply With Quote
  #2  
Old   
Jon Lewis
 
Posts: n/a

Default Re: OpenArgs passing form/subform/control and using to requery? - 06-03-2010 , 05:38 AM






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 (AT) gmail (DOT) com> wrote

Quote:
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.

Reply With Quote
  #3  
Old   
Ramses
 
Posts: n/a

Default Re: OpenArgs passing form/subform/control and using to requery? - 06-03-2010 , 08:09 AM



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... (AT) cutthespambtinternet (DOT) com>
wrote:
Quote:
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

Reply With Quote
  #4  
Old   
Jon Lewis
 
Posts: n/a

Default Re: OpenArgs passing form/subform/control and using to requery? - 06-07-2010 , 12:27 PM



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 (AT) gmail (DOT) com> wrote

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... (AT) cutthespambtinternet (DOT) com>
wrote:
Quote:
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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.