Select Sub-Report Based on Field Value (1 Viewer)

HeatherO

Registered User.
Local time
Today, 09:14
Joined
Apr 21, 2017
Messages
45
I am creating a report called "Move-In Letter". The first paragraph of the report will be a different sub-report based on the value of one particular field. I cannot seem to get the IF statement right. Below is what I'm using.

=IIf([FullRenewal]=No,[Report].[Test],[Report].[KeyPickUp])


I keep getting parameter boxes and neither sub report shows up on the report. Any ideas?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:14
Joined
Aug 30, 2003
Messages
36,125
Untested, but I think you'd need to set the source object property of the subreport in the main report's open event. Either that or toggle visibility.
 

HeatherO

Registered User.
Local time
Today, 09:14
Joined
Apr 21, 2017
Messages
45
No luck with that. However, I did change the formula from [Report] to [Reports]. That eliminated the parameter boxes but now in report view, it comes up "#Name?" :banghead:
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:14
Joined
Aug 30, 2003
Messages
36,125
Hard to determine why the code didn't work since you didn't post it. ;)

To refer to a control on a report you'd have to use the full reference:

http://www.theaccessweb.com/forms/frm0031.htm

using Reports/Report instead of Forms/Form. They would have to be open.
 

Users who are viewing this thread

Top Bottom