Click to See Complete Forum and Search --> : “Report sections do not match data source”
jtm7699
Jul 13th, 2000, 02:06 PM
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.
thnks
Nathan
Jul 13th, 2000, 02:27 PM
this is because your recordset for your report does not have grouping in it. Give an example of what you're looking to do and i might be able to help.
jtm7699
Jul 13th, 2000, 02:41 PM
PARAMETERS ID Text ( 255 );
SELECT Audiologist.AAU_FirstName, Audiologist.AAU_LastName, Audiologist.AAU_Bldg, Audiologist.AAU_Room, Audiologist.AAU_Phone, Audiologist.AAU_Email, Client.ACL_FirstName, Client.ACL_LastName, Schedule.ASC_ApptDate, Schedule.ASC_AST_Type, Schedule.ASC_ACL_ID
FROM Client INNER JOIN (Audiologist INNER JOIN Schedule ON Audiologist.AAU_ID = Schedule.ASC_AAU_ID) ON Client.ACL_ID = Schedule.ASC_ACL_ID
WHERE (((Schedule.ASC_ApptDate)>Date()) AND ((Schedule.ASC_ACL_ID)=[id]));
This is the SQL that I am using to get date for the Report. The Schedule.ASC_ApptDate is the option that i want to display. this is the only one that changes. The other fields will be constant.
Nathan
Jul 13th, 2000, 03:39 PM
so do you want the Schedule.ASC_ApptDate to be the only information in the detail section with the rest of the information in the header? Try looking at the SHAPE command and let me know if you need help with it.
jtm7699
Jul 13th, 2000, 05:16 PM
yes Schedule.ASC_ApptDate is all that i want. Where would i use the shape command. In code or in the Query
Nathan
Jul 14th, 2000, 07:45 AM
If you do not have any parameters that you need to use in getting your recordset it would be easiest to set up a childcommand in the dataenvironment and base your report on that. However if you need to use parameters it gets tricky...
the shape would be used in your query through code... I'll give you an example of one that i used, it's a bit more complex but it should be able to show you how to set up a datareport with parent and child tables.
'create the connection string
ConnectString = "Provider=MSDataShape;Data Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;" & _
"Server=" & C1_Server & ";Database=" & C1_DBName
'open msdatashape connection
cn.Open ConnectString
'create shape sql command
strSQL = "SHAPE {SELECT RefNo, RefPart, Date, StyleID, " & _
"Author, Labor, LaborHrs, Description, " & _
"Customer, SubTotal, Discount, DscAmount, " & _
"sOrdered = CASE Ordered WHEN '0' THEN 'No' ELSE 'Yes' END, " & _
"sOrderedQty = CASE Ordered WHEN '0' THEN '' ELSE CAST(OrderedQty AS CHAR) END, " & _
"Comment, GrandTotal, LaborTTL FROM " & C1_DBName & ".dbo.CUSTCOST " & _
"WHERE RefNo = '" & txtRefNo.Text & "' AND StyleID = '" & _
txtStyle.Text & "'} AS PrintMain " & _
"APPEND ({SELECT Price, Qty, CustDesc, Total, " & _
"RefNo, StyleID FROM " & C1_DBName & ".dbo.CCITEMS WHERE RefNo = '" & _
txtRefNo.Text & "' AND StyleID = '" & _
txtStyle.Text & "'} AS PrintChild " & _
"RELATE 'RefNo' TO PARAMETER 0,'StyleID' TO PARAMETER 1) " & _
"AS PrintChild"
DE1.rsPrintMain.Open strSQL, cn, adOpenStatic, adLockReadOnly
Now to explain it... in the query CUSTCOST is the main table and ITEMS is a details table where there can be many ITEMS for each CUSTCOST record. I set up a data environment command with a child command that will contain the same fields that I would need in my report and that would be retrieved in my shape command query. Then I created the datareport based on the command in my dataenvironment. Then in code before you open the report you need to do a couple of things... first you need to open a shape connection... as shown... then you need to open the recordset with a shape sql string. (also shown...) then you can open the report that is based on this recordset. Clear as mud? anyway if you need more help let me know.
jtm7699
Jul 14th, 2000, 10:03 AM
Nathan thanks for all you help. I finally used the Parent/Child idea. Passing parameters was not all that hard. I just have to call the query prior to opening the report. The shild query which also wants the ID just is linked to it in the realations. It all seems to work
Gopinath Babu
Nov 27th, 2007, 05:44 AM
this is because your recordset for your report does not have grouping in it. Give an example of what you're looking to do and i might be able to help.
Dear friend,
I was actually trying to have a Recordset field to be bounded with the header section since the header section does not allow bounding we have tried with group header since the group header is looking for a record set of grouping nature I can't do it.Kindly help us
regards
Gopi
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.