Question : How to reference a subform

I have a subform embedded in a form. The subform is called frmLPMSummarySub and the form is called frmLPMSummary. I want to modify the recordsource of the subform but don't know how to reference the subform.

Here's the syntax I'm using:

Me!frmLPMSummarySub.Form.RecordSource = ReplaceWhereClause(Me!frmLPMSummarySub.Form.RecordSource, vWhereClause)

Me!frmLPMSummarySub.Form.Requery
   
These produce the an error telling me that: "MS Access can't find the field "frmLPMSummarySub" referred to in your expression"

I should also mention that  the code-behind file for frmLPMSummary has been renamed in the project explorer as Form_frmLPMSummary and that there is no code-behind file for frmLPMSummarySub (not sure if it should have one).

Dan

Answer : How to reference a subform

You are using it the right way:

Me!.Form.RecordSouce

so you are probably not using the right name for the sub form. The error indicates that too.

Open the main form and click on the subform. Look in the properties (the Other tab) and find
the what it's called at the property Name.
Use that one in your reference call, instead of frmLPMSummarySub
Random Solutions  
 
programming4us programming4us