Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-08-03
7
Medium Priority
?
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 150 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

596 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