When I add the Group header, i get the following error "Report sections do not match data source" when running. How do i avoid this error. Section 1 is my group header, SQL_Detail is my section for listing the results.
And I do not use a data environment.
Code:Dim rpt As New RptBydept rs.Open "SELECT Machine, UserID, [Software Title], Version, Department, [Assigned Date], Server FROM [MS Office Licenses] WHERE " & s & " and UserID NOT LIKE '--%' GROUP BY Department,Machine, UserID, [Software Title], Version,[Assigned Date], Server ORDER BY [" & CmbOrderby1.Text & "], [" & CmbOrderby2.Text & "]", Cn, adOpenStatic, adLockOptimistic 'Update fields and datareport control names to those you use 'Set datasource and bind recordset fields. Set rpt.DataSource = rs With rpt.Sections("SQL_Detail") .Controls("Text1").DataField = "UserID" 'where quantity is a field in the recordset .Controls("Text2").DataField = "Software Title" .Controls("Text3").DataField = "Version" .Controls("Text4").DataField = "Department" .Controls("Text5").DataField = "Server" .Controls("Text6").DataField = "Assigned Date" .Controls("Text7").DataField = "Machine" End With rpt.Sections("Section2").Controls("Label15").Caption = rs.RecordCount rpt.Sections("Section1").Controls("Label17").Caption = area rpt.Show vbModal Unload rpt Call DBDisconnect Set rpt = Nothing 'Unload FrmReports Exit Sub




Reply With Quote