What's the trick?

  • Thread starter Thread starter Fuzzy Logic
  • Start date Start date
F

Fuzzy Logic

I have a form with 3 subforms. When I make a change to one subform how do I
get the other subforms to update?
 
Have you checked out the usefullness of Form_Current or Form_AfterUpdate?

My understanding is AfterUpdate triggers when a record is saved to the
database. THen perhaps, you could use that to trigger updates in the other
forms by calling macro's or something stored in those forms?

just a guess, i'm no guru. =D

-dpharr
 
I have a form with 3 subforms. When I make a change to one subform how do I
get the other subforms to update?

What's "updating"?

You may want to Requery the other subforms in each Subform's
AfterUpdate event, but it seems a bit peculiar to have subforms
dependent upon one another. What are the Recordsources of these
subforms? In what way are they interdependent?

The code would be something like:

Private Sub Form_AfterUpdate(Cancel as Integer)
Parent!subSubform2.Requery
Parent!subSubform3.Requery
End Sub

where subSubform2 and 3 are the Name properties of the other Subform
controls on the mainform (which may or may not be the same as the name
of the form within that subform control).

John W. Vinson[MVP]
 
What's "updating"?

You may want to Requery the other subforms in each Subform's
AfterUpdate event, but it seems a bit peculiar to have subforms
dependent upon one another. What are the Recordsources of these
subforms? In what way are they interdependent?

The code would be something like:

Private Sub Form_AfterUpdate(Cancel as Integer)
Parent!subSubform2.Requery
Parent!subSubform3.Requery
End Sub

where subSubform2 and 3 are the Name properties of the other Subform
controls on the mainform (which may or may not be the same as the name
of the form within that subform control).

John W. Vinson[MVP]

I have one subform that lists detail records and two other subforms that are
essentially totals. One total is of all time for the detail records and the
other is a selective total of detail records. If I change the detail record
from yes to no (or vice versa) I want the selective total to update.

Where do I find the subform control (I keep reading about this but can't for
the life of me find it)?
 
I have one subform that lists detail records and two other subforms that are
essentially totals. One total is of all time for the detail records and the
other is a selective total of detail records. If I change the detail record
from yes to no (or vice versa) I want the selective total to update.

Hrm. Rather than a separate Subform, I'd suggest putting a Textbox on
the subform footer with either a Sum() expression or a call to the
DSum() function. For instance, you could have a calculated field in
the subform's Query defined as

SelectivePart: IIf([YesNoField], [NumberField], 0)

If you put a textbox in the form footer with a control source

=Sum([SelectivePart])

it will show the sum of the values of NumberField for which the same
record's YesNoField is true.
Where do I find the subform control (I keep reading about this but can't for
the life of me find it)?

It's the forest right near all those trees... <bg>

It's the "box" on the main form which contains the subform. If you
mouseclick on its edge with the Properties window visible, you'll see
that it has properties such as Master Link Field and Child Link Field.
You can also select it from the list of controls in the combo box at
the upper left next to the default toolbar.


John W. Vinson[MVP]
 
Back
Top