Cross-form communications

B

Bill Stanton

I have a form with two sub-forms. In the code-sheet
of one of the sub-forms, how do I trigger a Requery
in the other sub-form. The following type of statements
don't work, but am I close?

forms!formname!filter = filter-expression
forms!formname.requery

Thanks,
Bill
 
S

Sandra Daigle

You would reference subformB through the parent of subformA

From SubformA:

me.parent.subformB.filter = strFilter
me.parent.subformB.requery

Where SubformB is the name of the second subform control on the parent form.
 
P

PC Datasheet

Forms!NameOfMainForm!NameOfSubform.Form.Requery


--
PC Datasheet
A Resource for Access, Excel and Word Applications
(e-mail address removed)
www.pcdatasheet.com

· Design and basic development for new applications
· Additions, Modifications and "Fixes" for existing applications
· Mentoring for do-it-yourselfers who want guidance
· Complete application design and development
· Applications Using Palm Pilot To Collect Data And
Synchronize The Data Back To Access Or Excel
 
B

Bill Stanton

From the code-sheet of 1st sub-form:

Private Sub Form_Click()
If Me.Parent.Name = "DonationEntry" Then
Forms!DonationEntry.Form!CurrentName.Caption = Me.FamilyName
' Me.Parent.DonationsSubform.Filter = "FamilyID = " & Me.FamilyID
' Me.Parent.DonationsSubform.Requery

Forms!DonationEntry!DonationsSubform.Form.Filter = "FamilyID = " &
Me.FamilyID
Forms!DonationEntry!DonationsSubform.Form.Requery
End If

End Sub

The main form is "DonationEntry" and the 2nd of the two sub-forms is
"DonationsSubform". As you can infer from what you see, I tried both
types of syntax. As you see paired or individually, I get a 2465 error.

Did I not understand what you've suggested?

Thanks,
Bill
 
P

PC Datasheet

Bill,

Please explain what you are trying to do in your code and please provide the
text of the 2465 error.

Steve
PC Datasheet
 
B

Bill Stanton

Steve,
I have a main form and two sub-forms. The first sub-form
is displaying a list of names from a table of families. The
second sub-form is displaying an array of dates and values
from a table that is normalized to the list in the fist sub-form.
When a name is selected in the first sub-form, the primary
key for its underlying RecordSource is used to specify
a filter for the second sub-form followed by a Requery for
the 2nd sub-form.

I get a 2465 with both types of statements posted earlier.
Using the Me.Parent.... form, the message text is "Application
defined or object define error". Using the Forms!... form,
the message text is "Can't find the field "DonationsSubform
referred to in your expression".

Hope this explains things a little better.

Thanks,
Bill
 
P

PC Datasheet

<<Using the Forms!... form, the message text is "Can't find the field
"DonationsSubform
referred to in your expression". >>

Forms!DonationEntry!DonationsSubform.Form.Filter = "FamilyID = " & Me.FamilyID
Forms!DonationEntry!DonationsSubform.Form.Requery

Open your DonationEntry form in design view. Select the subform control that
holds your Donations subform. Open properties, go to the Other tab and name the
control DonationsSubform.

Steve
PC Datasheet
 
B

Bill Stanton

I'm embarrassed! I thought I'd checked that, but didn't notice
there was a blank between "Donations" and "Subform".

Thanks for waking me up!

Bill
 

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