Referencing Subform 2 from Subform 1

P

PJFry

I have an application where I would ideally have a continous form with a
subform. Since I can't do that, I have a form with two subforms. What I
want to do is apply a filter to subform 2 using a control on subform 1.

Main form: fSelectData_All
SF1: sfSelectData
SF2: sfPartsList

The control, btnViewParts is on SF1. When the user clicks this control, I
want to apply a fitler to SF2 based on the the MaterialRequestID on SF1. SF2
has a field for the MaterialRequestID called lngMaterialRequestID.

Here is the code I have for btnViewParts on sfSelectData:
stLinkCriteria = "[lngMaterialRequestID]=" & Me![MaterialRequestID]
Forms!fSelectData_All!sfPartList.Form.ApplyFilter = stLinkCriteria
Forms!fSelectData_All!sfPartList.Form.FilterOn = True

Any thoughts on how to accomplish this?

Thanks!
PJ
 
P

Piet Linden

I have an application where I would ideally have a continous form with a
subform.  Since I can't do that, I have a form with two subforms.  What I
want to do is apply a filter to subform 2 using a control on subform 1.  

Main form: fSelectData_All
SF1: sfSelectData
SF2: sfPartsList

The control, btnViewParts is on SF1.  When the user clicks this control, I
want to apply a fitler to SF2 based on the the MaterialRequestID on SF1.  SF2
has a field for the MaterialRequestID called lngMaterialRequestID.  

Here is the code I have for btnViewParts on sfSelectData:
stLinkCriteria = "[lngMaterialRequestID]=" & Me![MaterialRequestID]
Forms!fSelectData_All!sfPartList.Form.ApplyFilter = stLinkCriteria
Forms!fSelectData_All!sfPartList.Form.FilterOn = True

Any thoughts on how to accomplish this?

Thanks!
PJ

this should help:
http://www.mvps.org/access/forms/frm0023.htm
 

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