troubleshooting Question

Data report grouping

Avatar of Marc_Fortin
Marc_Fortin asked on
Visual Basic Classic
1 Comment1 Solution170 ViewsLast Modified:

I have created a Data Report using the Data Report Designer.

The recordsource for the report is coded into the application using the following

rstRapport.Open "SELECT Lot.LotID, Lot.LotNom,Echantillon.EchantillonRefClientID,Echantillon.EchantillonDateEntree, Echantillon.EchantillonDateSortie, Echantillon.ModeSortie, Echantillon.EchantillonNom, Echantillon.EchantillonLongueur, Echantillon.EchantillonLargeur, Echantillon.EchantillonEpaisseur, Echantillon.EchantillonMateriau, Echantillon.EchantillonMagnetise, Echantillon.EchantillonSystemeMetric, Echantillon.EchantillonCommentaire, Type.TypeNom, ZoneEchantillon.ZoneNom, Defaut.DefautNom, Defaut.DefautLocalisation, Defaut.DefautLongueur, Defaut.DefautLargeur, Defaut.DefautProfondeur, Defaut.TypeDefaut, Echantillon.EchantillonID FROM ZoneEchantillon INNER JOIN (Type INNER JOIN (Lot INNER JOIN (Echantillon INNER JOIN Defaut ON Echantillon.EchantillonID = Defaut.EchantillonID) ON Lot.LotID = Echantillon.LotID) ON Type.TypeID = Echantillon.TypeID) ON ZoneEchantillon.ZoneID = Echantillon.ZoneID WHERE Lot.LotID = rstEchantillon.Fields("LotID").Value, cnn, adOpenKeyset, adLockOptimistic, adCmdText
' Connect the Recordset to the DataReport.
Set rptReport.DataSource = rstRapport

There is no problem with this and it works as it should, however what I need to be able to do is to add a Group Header/Footer into the report and have the data grouped on the "EchantillonNom" field of the SQL. If I do this then I get an error saying that "Report Sections do not match data source".

How can I get this to work?

Note that if I use a Data Environment object to product the group data and add the Data Environment as the recordsource for the report then I can get it to work. But I really would like to do it in code

Any help appreciated thanks
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros