View Full Version : Dynamic Group Header based on sort...


doran_doran
01-13-2004, 11:48 AM
Hello,

I have a report and i impletemented "How to Sort a Report from a Pop-Up Form" http://support.microsoft.com/default.aspx?scid=kb;en-us;146310 from microsoft.

It's working fantastic.

I would like to know how do I dynamically change the header based on what field I picked from my form.

Anyhelp will be appreciated.

Regards
Dianna

WayneRyan
01-13-2004, 12:38 PM
Dianna,

You can use some event like the FormatHeader event
to:


If Forms![YourForm]![CriteriaField] = "SomeValue" Then
Me.HeaderText = "Something"
Else
Me.HeaderText = "SomethingElse"
End If


If there are a lot of different values, you could use
a Case statement.

Also, maybe you could do something in the OnOpen event
of the Report so that you only do it once.

Wayne

doran_doran
01-14-2004, 09:30 PM
Hello,

Ok, here is the database.

http://www.dbforums.com/attachment.php?postid=3602706

1. open the form called "frmOrderBy"
2. When you open this form the report "rptMasterList" gets loaded.
3. And you can now do dynamic sorting.

Everything is working fine.

1. Ok, Now open a report called "rpt5500all" for sample purpose
2. Notice the header "Primary Administrator"
3. I would like to have a header like this for my report "rptMasterList".
4. This header will be driven by the selection made in the "frmOrderBy"
5. If I select PYE, then the header should read PYE or what have you.
6. and a total for whatever the dynamic group header is.

Let me know if this is something can be done.

Thanks in advance.

Dianna