4 subforms on each of 5 pages on a tab control

  • Thread starter ragtopcaddy via AccessMonster.com
  • Start date
R

ragtopcaddy via AccessMonster.com

I have a form that has a tab control. The tab control is for yearly info
(2003,2004,etc.) and has 5 pages. Each page has 4 identical subforms
displaying monthly data (month and amount). Do I have to have 20 subforms, (4
subforms X 5 pages) or is there some method where I could use just 4 subforms
and reset the querydef when a new page is selected? I copied and pasted the 4
subforms on the first page, onto each of the other 4 pages. Consequently, the
4 subform controls on each page have the same form sourceobjects as those on
every other page.

I have a routine that rewrites the 4 qdfs based on which tab is selected, but
I'm having trouble getting the subforms to display the new query results when
I select a new page.
 
R

ragtopcaddy via AccessMonster.com

OK. Once again, asking the question prodded my decrepit memory!

The 4 subform controls on each of the 5 pages are referencing the same
subform object. I implemented a numbered naming scheme ("pg1Sales",
"pg2Sales") for the controls on the tab pages. They all reference sfrmSales.
I also named the tabs for the years (2003, 2004, etc.). So, after I rewrite
the querydef to reflect the year in the page name, I just have to reset the
sourceobject:

With Me.Controls("pg" & nYr - 2002 & "Sales")
.SourceObject = .SourceObject
End With

nYr is the year in the page name, so nYr - 2002 = 1

Damn, I'm good! Not smart, but good!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top