Marc_Fortin
asked on
Data report grouping
Hi,
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.Ech antillonRe fClientID, Echantillo n.Echantil lonDateEnt ree, Echantillon.EchantillonDat eSortie, Echantillon.ModeSortie, Echantillon.EchantillonNom , Echantillon.EchantillonLon gueur, Echantillon.EchantillonLar geur, Echantillon.EchantillonEpa isseur, Echantillon.EchantillonMat eriau, Echantillon.EchantillonMag netise, Echantillon.EchantillonSys temeMetric , Echantillon.EchantillonCom mentaire, 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("Lot ID").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
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.Ech
' 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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.