Solved

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

Posted on 2004-08-03
7
290 Views
Last Modified: 2008-01-09
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.
0
Comment
Question by:devtha
  • 3
  • 2
  • 2
7 Comments
 
LVL 18

Expert Comment

by:Data-Man
ID: 11709745
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

0
 
LVL 18

Expert Comment

by:Data-Man
ID: 11709794
sorry, the subform container object should be the same name in both lines of code

sfmcontainer

Mike
0
 
LVL 44

Expert Comment

by:GRayL
ID: 11709807
You have access to these values with:

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

Forms!FormName.form!sfmName.LinkChildFields = <Enter Value>
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Author Comment

by:devtha
ID: 11709862
hello,
        I need this for REPORT.

Thanks
0
 
LVL 6

Author Comment

by:devtha
ID: 11709871
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
0
 
LVL 6

Author Comment

by:devtha
ID: 11709880
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.
0
 
LVL 44

Accepted Solution

by:
GRayL earned 50 total points
ID: 11710123
Change:
Forms!FormName.form!sfmName.LinkMasterFields = <Enter Value>

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

to:
Reports!ReportName.report!srptName.LinkMasterFields = <Enter Value>

Reports!ReportName.report!srptName.LinkChildFields = <Enter Value>

srptName is the subreport name
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now