Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamically define sub reports within a form 1

Status
Not open for further replies.

03Explorer

Technical User
Sep 13, 2005
304
US
I have been trying many methods to go from:

me!rpt1.Report.RecordSource = SQL
me!rpt2.Report.RecordSource = SQL
me!rpt3.Report.RecordSource = SQL
me!rpt4.Report.RecordSource = SQL

to something like this

For N = 1 to 4
me!rpt[N].Report.RecordSource = SQL​
Next N

but it's not working and I am pounding sand trying to figure this (should be simple) thing out.

Thanks,
 
I'm not sure what you are attempting to accomplish but I would suggest trying:

Code:
For N = 1 to 4
   me("rpt" & N).Report.RecordSource = SQL
Next N

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thank you Duane!

I am working on a dynamic form that has sub reports or pillars as business likes to call them. It's a summary view of high-level data points. Each sub report currently is created manually and statically in a static location. So let's say associate 1 has pillar 2 only populated... 1, 3 and 4 are hidden. Then if they work in other pillars they are also unhidden. (That was version 1, now in version 2 we have 2 more pillars, but different business type). So now I have people who wouldn't have 1 -4 but maybe 5 or 6 showing up... the form looks like it has cancer b/c the unhidden subReport is not in the #1 spot where I'd expect.

So my re-engineering of the form I am looking at how I can cycle through the sub reports based on variable/counter driven.

Much gratitude for your prompt response to my question.
Rob

Duane, your code works like a champ!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top