Report grouping at runtime

H

Harley Feldman

I am creating a report which I would like to modify at runtime. It has three group levels which were created in Design View and are invisible. From a form, the user can select 1 - 3 levels of grouping, and invoke the following code for each level selected:

Me.GroupLevel(n).ControlSource = strFieldName(intI)
Me.GroupLevel(n).KeepTogether = 2
Me.GroupHeadern.Visible = True

where n is 0 to 2.

I also want to display in the group header the group description which is included in the query for the Record Source for the report.

In the On Open Event, when I try to put the Me.MeansName text box in the group header, and then fill it, I get a message that I cannot reference the control as it does not have the focus. I have since learned that controls are not complete until the form finishes its open event and therefore SetFocus does not work.

What should I do to be able to display the grouping name in the group header?

Harley
 
G

Guest

You can't change Values or ControlSources once printing starts, but you can
change Label captions. Try creating a Label on the Form and setting the
Label.Caption in the Grouping Level's OnFormat event.
 
H

Harley Feldman

Matarcallarse,

Thanks for the advice. It causes me a bit more coding due to another
routines that I need to call, but it works!

Harley
 

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