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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi. I'm relatively new to reports i

Status
Not open for further replies.

azalealee

Programmer
Nov 21, 2002
36
AU
Hi. I'm relatively new to reports in access. So please be patient.

I have a report based on a query. Depending on a selection a user makes from an option group on a form, I would like a group header to be created that reflects their selection.
Eg Sort by Leader or Sort By Category

I have tried creating a group level, but it doesn't work and generates an error "Expected End Sub".

Private Sub Report_Open(Cancel As Integer)
Sub CreateGL()
Dim varGroupLevel As Variant
varGroupLevel = CreateGroupLevel("R_Generic_Report", "IIf(Forms!F_ReportsMenu!SortBy_Op_Group=1,M_HASIFDB.Relevant_Leader,M_HASIFDB.Category)", _
True, True)
Reports!OrderReport.Section(acGroupLevel1Header).Height = 400
Reports!OrderReport.Section(acGroupLevel1Footer).Height = 10
End Sub
End Sub

Is there a way of creating a variable header(and sorting) based on the option group selection from a form?

Thanks in advance. Azalea.
 
Hi, this might help you out a little. This is out of one of my reports using Select Case to refer back to an option group. It defines the record source, group level control source and other grouping options.

Select Case Forms.frmmainmenu.FramePlst

Case 3
Me.RecordSource = FuncSuSql 'Punchlist
Me.GroupLevel(0).ControlSource = "[System]"
Me.GroupLevel(1).ControlSource = "[Priority]"
Me.GroupLevel(2).ControlSource = "[Duedate]"
KeepTogether = yes
GrpKeepTogether = 0
ForceNewPage = 1
Me.txtSyS.FontBold = True
Me.txtPri.FontBold = True
Me.TextDueDt.FontBold = False

End Select

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top