[AccessD] passing info to a subform sourceobject change

JWColby jwcolby at colbyconsulting.com
Wed Mar 14 16:18:28 CDT 2007


>Are the OpenArgs <u>only</u> available through docmd.Open?

Well... I don't know but I think OpenArgs is something like a parameter to a
function behind the scenes that gets called when Docmd.Open is called.  That
implies that the form itself has some kind property that can be set.  In
fact in later versions I think there is actually an openargs property of the
form itself that you can view the openargs string (and perhaps even set).  

The issue really is that when you set the subform control's property to load
the form, the form is not yet defined and so you cannot set the .openargs
property of the form.  After you load the subform, all the form's events
fire and run BEFORE control is returned to your code back in the parent form
so you might be able to set the openargs property of the subform LATER, but
how do you cause them to be processed?

In fact I suppose that you could also "PUSH" the openargs value into the
subform by having a public FUNCTION of the SUBFORM that you call from the
parent form, passing a value in (the openargs) and then the function in the
subform continues running processing those "openargs".  Either way, it is
NOT the same as the OpenArgs being processed as the form opens.

I actually have an OpenArgs class that grabs the openargs in the OnOpen of
the form and processes them out.  I can pass in OpenArgs in the format:

VarName1=VarVal1;VarName2=VarVal2;etc;etc;

My class pulls out the openargs string looking for the = and ; and parses
the openargs, placing the into a collection keyed on the varname.  The form
can then (knowing what openargs are expected, by name) reach into the class
and ask for varvalues by varname.  Basically it just saves having to do the
code for the parsing in each form - just load the class and let her rip.
How the form uses the VarVals is up to each form.

Again though, this only works where an OpenArg string already exists in the
property by the time OnOpen fires.  What you are doing does not allow that.

John W. Colby
Colby Consulting
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bruce Bruen
Sent: Wednesday, March 14, 2007 4:54 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] passing info to a subform sourceobject change

Thanks John! That was the clue I needed.  I couldn't see the forest for the
treeview, so to speak.

I actually added it as a property to the parent form (F) which now lets me
do all kinds of nefarious jiggling when things are changed in either the
form or the subform!  I am even considering the possibility of a user driven
morphing of monkey-wrench's into grapefruit.

One question (only of interest mainly) ..  Are the OpenArgs <u>only</u>
available through docmd.Open? Is there any other structure that can set
them?


bruce

On Wednesday 14 March 2007 22:55, JWColby wrote:
> It is possible, but not using the OpenArgs AFAIK.  The reason is that
> OpenArgs is passed in the Docmd.Open syntax, which isn't running in this
> case.
>
> You can "pull" a string into the sub form as it opens.  Have the code that
> is manipulating the subform's SourceObject set a public variable in the
> form's header and then when the subform opens, have the form examine
> me.parent.MyVariableName.  That should do it.
>
> John W. Colby
> Colby Consulting
> www.ColbyConsulting.com
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bruce Bruen
> Sent: Wednesday, March 14, 2007 6:46 AM
> To: Access Developers discussion and problem solving
> Subject: [AccessD] passing info to a subform sourceobject change
>
> What i've got is a form F with a subform S that changes freqently.  I
mean,
> that, depending on the current row of F  (which defines it's specific
type)
> then the form that is used for S changes, i.e. I swap its SourceObject.
>
> So if the current row in F is an "apple", then the subform S shows the
> "subApple" form.  However, if the current F row is a "socket wrench" then
S
> shows the "subSWrench" form. ------> This all currently works great.
>
> But now I find that I want to send some important information to some of
> the subforms when I set them.  For example, I may want to send the
> S.variety value to the subApple form or conversely the s.Size value to the
> subSWrench form.
>
> So, having found that changing  F.genericSubForm.SourceObject actually
> fires the new subform's OnOpen event I am trying to work out how to use
> it's OpenArgs() to pass the data.
>
> Is this possible?  Am I barking mad?  Has anyone got any ideas?
>
> or should I grab my Terry Jacks' albums and just move to suvern
kelifornya?
>
>
> --
> regards
>
> Bruce
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

-- 
regards

Bruce
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list