Filter Records on one Subform on Selection in Another Subform

  • Thread starter Thread starter Jim C.
  • Start date Start date
J

Jim C.

I have a main form that contains two subforms. I need to filter the
records on one subform based on the record selected in the other
subform.

I need help specifically on how to call the Filtering method I have
established in the dependant subform from the presidential subform.

Do I need to create a procedure on my main form to get this to work or
can I call this method directly one subform to another.?

Probably another easy one for you. Thanks for all your help in the
past, you always seem to solve the tough ones.

Regards,

Jim C.
Using MS Office 97, MS Windows 98
 
Jim C. said:
I have a main form that contains two subforms. I need to filter the
records on one subform based on the record selected in the other
subform.

I need help specifically on how to call the Filtering method I have
established in the dependant subform from the presidential subform.

Do I need to create a procedure on my main form to get this to work or
can I call this method directly one subform to another.?

Probably another easy one for you. Thanks for all your help in the
past, you always seem to solve the tough ones.

Regards,

Jim C.
Using MS Office 97, MS Windows 98


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
you should be able to filter one subform from another
subform. here's an example of one way i can think of:

we'll call the forms
Form1 (main form)
Form1A (first subform)
Form1B (second subform)

in Form1A's OnCurrent event, enter code
**air code**
Dim frmParent as Form
Set frmParent = Forms!Form1

frmParent!Form1B.Filter = "Form1BFieldName = " & frmParent!
Form1A!Form1AControlName
(that works for a numeric value; if the value is text,
then use the next line instead)
frmParent!Form1B.Filter = "Form1BFieldName = '" &
frmParent!Form1A!Form1AControlName & "'"
frmParent!Form1B.FilterOn = True
**air code**

hth
 
Thanks tina

I managed to solve the problem in much the same manner as you
described. I used the following line to pass an argument to my
dependant subform and called a routine that does several tasks during
the requery.

Me.Parent.Form.SubFormName.Form.PublicFilteringMethod Criteria

I believe that this approach will restrict changes to the subform
filter property to only the instance of the subform embedded in the
main form. Other instances of the same subform should not be
affected.

This is working marvelously.

I may place a routine, built on the idea you presented, in my global
module that will allow me to perform the subform to subform filtering
operation in any form.

Thanks again for your response

Regards,

Jim C.
Using MS Office 97, MS Windows 98
 
Back
Top