Solved

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

Posted on 2004-08-03
7
292 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dsum Function for List Box Data 7 45
MS Access: Adding Reference for Dymo 450 Labelwriter SDK 6 17
Reference Controls on subforms 7 28
Filter a form 8 12
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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