Synching main form ->subform1->subform2

D

David Portwood

I have a Main form displaying two subforms where subform1->>subform2. I do
this using a nonstandard link field in the main form per recent directions
from this group. The current() method of subform1 sets the link field and
subform2 syncs itself accordingly.

This works ok except in one case: when arriving on a Main record for which
subform1 is empty, evidently the current() method of subform1 does not fire
and therefore subform2 does not change to empty as well.

I have been unable to fix this, probably because I'm still unsure of the
event stream. Does anybody have any suggestions?
 
S

strive4peace

Hi David,

put the code to requery subform2 also on the main form current event if
the link fields do not work

What is in the LinkMasterFields for subform2?

"The current() method of subform1 sets the link field "

what do you mean by this?

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
D

David Portwood

It's a bit more complicated than I would like. See the thread "Three tiers
on a form" on 5/2/2007.

Basically, I have a Main form ->>Subform1->>Subform2. I want to display the
Main form in single form style and the subforms as separate (not embedded)
datasheets while still retaining the relationships, but Access doesn't allow
a subform that is not directly linked to the main form. So subform2 must be
embedded in subform1 or some kind of workaround is required.

The solution revolves around putting an unbound nonstandard link field on
the main form which subform1 populates with its primary key from its
current() method. Subform2 is linked to this unbound field and synchronizes
itself accordingly. Sounds bizarre, but it works, except for the problem I
described where subform1 might be empty for some record in the main form.
When this happens, the current() method of subform1 doesn't fire (I presume)
to populate the link field and subform2 doesn't update.

If you have another layout suggestion that would be clear to my users I'd
love to hear it. I can't believe this situation doesn't come up regularly.
 
S

strive4peace

Hi David,

for subform2

LinkMasterFields --> subform1_controlname.form.controlname

no goofy stuff or unbound controls necessary :)


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
D

David Portwood

Thanks, Crystal, but I got fed up with the "goofy stuff" and now I just have
a button which opens subform2 as a separate form now. I can't believe this
situation is rare. Why wasn't I bombarded with "I did it this way!"
responses? Well, no matter now.
 
S

strive4peace

Hi David,

you're welcome ;)

"now I just have a button which opens subform2 as a separate form now"

that works too :)

you may want to put this as the DefaultValue for your foreign key (and
it does not need to be Visible):

=forms!formname!controlname

then you don't have to worry about it
Why wasn't I bombarded with "I did it this way!" responses?<

I can't say ... but at least you got a workable solution -- sometimes it
is better to open another form anyway :)

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

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