Updating one subform from a different subform?

  • Thread starter Thread starter jason.varisco
  • Start date Start date
J

jason.varisco

I have a main form call Contacts. On this form I have two subforms,
ActsMain and ActsNotes.
ActsNotes has its recordsource set to the current selected record ID in
ActsMain.

What I want to accomplish is when a user selects a different record in
ActsMain, ActNotes is automatically refreshed/requeried to display the
new ActNotes field.

I can shift-F9 on ActNotes manually, but I cannot get the code right to
do it using an event (trying to use On Click).

I've tried several suggestions from previous threads here but none seem
to work. Any ideas would be appreciated.
 
I have a main form call Contacts. On this form I have two subforms,
ActsMain and ActsNotes.
ActsNotes has its recordsource set to the current selected record ID in
ActsMain.

What I want to accomplish is when a user selects a different record in
ActsMain, ActNotes is automatically refreshed/requeried to display the
new ActNotes field.

I can shift-F9 on ActNotes manually, but I cannot get the code right to
do it using an event (trying to use On Click).

I've tried several suggestions from previous threads here but none seem
to work. Any ideas would be appreciated.

Assuming Actsmain and ActsNotes share a field in common then create an invisible
testbox on the Contacts form and set it's ControlSource to
=ActsMainSubFormName.Form!YourControlField
Then Set the LinkChild/MasterField of the ActsNotes SubFormControl to point to
your invisible TextBox. You need to use your form and control names of course.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Could you be more specific on the structure? I've tried several
variations of what you've posted and none work. I simply get #name? as
the resulting value.

Contacts is the name of the Main Form.
ActMain and ActNotes are the subforms of the Contacts Form.
ActMain and ActNotes both share the field ActID, which is what I want
them to link from.
 
I finally go the ACTID value to show up on the main form. However, now
when I go to attempt to link child/master fields it's telling me I must
use value "ConID" (which is a different value on the main form). It
won't let me select the new text box I created on the main form.
 
An alternative:

In the OnCurrent event of the ActsMain form

me.ActNotes,requery

Since it is a ActsMain is a subform the requery may have to be

forms![Contacts]![form]![ActNotes].requery


The [Form] part may or may not be necessary. (I can't remember any of
my systems right now that do that, but it does work.)

Ron
 
I finally go the ACTID value to show up on the main form. However, now
when I go to attempt to link child/master fields it's telling me I must
use value "ConID" (which is a different value on the main form). It
won't let me select the new text box I created on the main form.

Just type the TextBoxName in. Don't worry about the wizard.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Back
Top