Link to home
Start Free TrialLog in
Avatar of devtha
devthaFlag for United States of America

asked on

LinkChildfields and Masterfields for a Subreport at runtime ( VBA code)

As described in the subject I need to link Master and child fields conditionally at run time
for a Master/Sub report using the VBA code..

Thanks in advance.
Avatar of Data-Man
Data-Man
Flag of United States of America image

Since the properties belong to the contain object, there is no problem doing this.  I did it on a project a long time ago.

Me.sfmContain.LinkMasterFields= "Myfield"
Me.sfmContainer.LinkChildFields= "MyOtherField"


Mike

sorry, the subform container object should be the same name in both lines of code

sfmcontainer

Mike
You have access to these values with:

Forms!FormName.form!sfmName.LinkMasterFields = <Enter Value>

Forms!FormName.form!sfmName.LinkChildFields = <Enter Value>
Avatar of devtha

ASKER

hello,
        I need this for REPORT.

Thanks
Avatar of devtha

ASKER

This would not work on ONFORMAT or ONOPEN
events.

 If Not IsNull(PrevBAC) Then
    qrySub1686OwnershipPrior.LinkMasterFields = "PrevLocPoint;PrevPlanNumber;FileDate"
    qrySub1686OwnershipPrior.LinkChildFields = "LocationPoint;PlanNumber;filedate"
 Else
    qrySub1686OwnershipPrior.LinkMasterFields = "LocationPoint;PlanNumber;filedate"
    qrySub1686OwnershipPrior.LinkChildFields = "LocationPoint;PlanNumber;filedate"
 End If
Avatar of devtha

ASKER

If I convert the report into a look alike FORM then, that will add to much work. If that is the only soultion I will think about going that way.
ASKER CERTIFIED SOLUTION
Avatar of GRayL
GRayL
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial