Solved

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

Posted on 2004-08-03
7
291 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

863 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