Microsoft Knowledge Base Email Alertz

KBAlertz.com: When you use a Report Control that is bound to a Visual Basic Data Environment command object and perform a GroupBy, you receive the following error:

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 200591 - Last Review: May 8, 2003 - Revision: 3.2

PRB: 8570 Report Sections Do Not Match DataSource

This article was previously published under Q200591

SYMPTOMS

When you use a Report Control that is bound to a Visual Basic Data Environment command object and perform a GroupBy, you receive the following error:
8570 Report sections do not match data source

CAUSE

One of the following has occurred:
  • The DataReport is bound to an ungrouped recordset.
  • The DataReport was created before binding the recordset.

RESOLUTION

The ADO Command object that the report is based on needs to be modified for grouping. Below is an example using Visual Basic 6.0's Data Environment and grouping in a report. Note that the command is doing the grouping, NOT the DataReport.
  1. Create a new Standard EXE project. Form1 is created by default.
  2. Add a reference to Microsoft ActiveX Data Objects 2.x Library.
  3. Add a DataEnvironment.
  4. Configure the Connection1 properties to use OLE DB Provider for SQL Server (SQLOLEDB) and the Northwind database (Nwind.mdb).
  5. Add a Command object off of Connection1.
  6. Configure the Command1 properties to use the Orders table and group by OrderDate (under the Grouping tab).
  7. Add a DataReport to your project.
  8. Set the DataSource to DataEnvironment1.
  9. Set the DataMember to Command1_Grouping.
  10. Right-click on DataReport1 and choose Retrieve Structure.
  11. From the Summary Fields in Command1_Grouping, click and drag the OrderDate field into the DataReport1 Group Header.
  12. Click and drag detail fields from the Detail Fields in Command1 into the DataReport1 Detail section.
  13. Add a CommandButton to Form1.
  14. Add the following code to Form1:
    Private Sub Command1_Click()
        DataReport1.Show 1
        Unload DataReport1
    End Sub
    					
  15. Run the project and click Command1.
It is important that the report sections match the command object's structure. If the error continues to occur, try using the Retrieve Structure command on the DataReport to refresh the sections. Retrieve Structure will remove all fields that are currently in the DataReport.

STATUS

This behavior is by design.

MORE INFORMATION

The example above assumes that you have a good understanding of how the DataEnvironment, DataReport, and ADO work.

The key to fixing this problem is to make sure that the data sections match the DataSource exactly. The most reliable way to do this is to use the Retrieve Structure command on the DataReport.

REFERENCES

For more information on ADO, please refer to your Visual Basic documentation or visit:

http://msdn.microsoft.com/en-us/data/aa937729.aspx (http://msdn.microsoft.com/en-us/data/aa937729.aspx) .

APPLIES TO
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Data Access Components 2.0
  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7
Keywords: 
kbdatabase kbdatabinding kbdataenv kbprb kbreportwriter KB200591
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please