Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2006, 07:44 AM
Registered User
 
Join Date: May 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem about refering subreport

I have a report called rptReference, rptReference has a subreport called rptLookupC, rptLookupC has a subreport called rptOutcomeC,that's:

rptReference
---rptLookupC
--------rptOutcomeC

In rptOutcomeC, there is a textbox called txtSdOrCdValue, the Sd value and cd value both come from tblTrial(see below)

tblTrial
ID SD value CD value
1 1.2
2 3.4
3 4.5
4 8.0
5 7.4

Either SD or CD has a value, but never both have values. The following is what the report would look like:

ID txtSdOrCdValue
1 SD=1.2
2 CD=3.4
3 SD=4.5
4 SD=8.0
5 CD=7.4

QUESTION:
1:How to refer to txtSdOrCdValue in VBA code? coz it is in the subReport, I have no idea how to do it?
2:Any method to fill in txtSdOrCdValue with SD or CD?

Thanks a lot

 
Old July 3rd, 2006, 07:37 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You can do this in the Detail section's On Format event.
Add the SD and CD fields to the subreport, and set their visible property to No.

Add code like this to the On Format event of the subreport:

If IsNull(Me.SD) Or Me.SD = "" Then
   Me.txtSdOrCdValue = Me.CD
Else
   Me.txtSdOrCdValue = Me.SD
End If

This should work, although there may be a problem with taking a value from a control like this at runtime. To fix that, take the value of SD and CD using conditionals, and then pass them to the txt control with a conditional.

Did that help?



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
refering url xzsolti Pro PHP 4 January 4th, 2005 07:15 PM
problem with subreport in CR lpastor Crystal Reports 0 November 17th, 2004 08:46 AM
Cyrstal report subreport problem keshavap Crystal Reports 0 September 24th, 2004 02:29 AM
Subreport Problem scorpion509 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 August 3rd, 2004 05:42 AM
Subreport problem: ADP + SQL Server pinkandthebrain Access 11 December 9th, 2003 03:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.