Link to home
Start Free TrialLog in
Avatar of DennisPost
DennisPostFlag for Netherlands

asked on

VB6 Datareports Group header & Details "sections do not match data source"

Hi,

At the moment we have invoices created with Crystal Reports 4.6, which works fine for us, but replaces some Czech characters with wrong characters.
So I have to make invoices datareport in visual basic 6, which does display all the charcters correctly.
Unfortunatley I have to go to the Czech Republic in 4 days with invoicing fully functional...... :-(

As I understand it, I have to split my recordset when I open it.
(https://www.experts-exchange.com/questions/20921702/Report-sections-do-not-match-data-source.html)
This goes beyond my experience, and so I need a little help from you guys.

We are using SQL 2000 View via an ADO recordset to get all the information.

The group header section will contain all the information about the invoice and the details section will
display the different charges and the calculations.

Here is the code I would like to adapt for our usage:
Dim rs As ADODB.Recordset
Dim child_rs As ADODB.Recordset

    Set rs = New ADODB.Recordset
    rs.LockType = adLockBatchOptimistic
    rs.Open _
        "SHAPE APPEND " & _
        "  New adVarChar(10) As ParentDay," & _
        "  ((SHAPE APPEND" & _
        "    New adVarChar(10) As ChildDay," & _
        "    New adVarChar(10) As Name," & _
        "    New adInteger As Amount)" & _
        "  RELATE ParentDay to ChildDay) As Child", _
        "Provider=MSDataShape;Data Provider=None"

    rs.AddNew Array("ParentDay"), Array("Monday")
    rs.AddNew Array("ParentDay"), Array("Tuesday")

    Set child_rs = rs("Child").Value
    child_rs.AddNew Array("ChildDay", "Name", "Amount"), Array("Monday", "Rod", -1.11)
    child_rs.AddNew Array("ChildDay", "Name", "Amount"), Array("Tuesday", "Rod", 2.22)
    child_rs.AddNew Array("ChildDay", "Name", "Amount"), Array("Monday", "Michelle", 11.11)
    child_rs.AddNew Array("ChildDay", "Name", "Amount"), Array("Tuesday", "Cobe", -22.22)
    Set rptTest.DataSource = rs
    rptTest.Show vbModal
    rs.Close

The main query will be:
SELECT * FROM PrintsInvoice WHERE InvoiceNr = " & glInvSel

The Child fields should be:
Descr (Varchar)
Qty (Decimal)
VALPP (Decimal)
VATPerc (Int)
VAT (Decimal)
ValEur (Decimal)

I will continue to experiment while I wait.
Eagerly awaiting your help with this or a better solution.
(btw, upgrading Crystal Reports is not a option for us.)

Thanks in advance !!!



Avatar of Mike McCracken
Mike McCracken

Is this about VB Datareport or Crystal?

mlmcc
Avatar of DennisPost

ASKER

VB Datareport.

I am also trying these 2 ms articles:
http://support.microsoft.com/kb/200591
http://support.microsoft.com/kb/q193866/
But I can even know how to add dataenviroment..... :-(

For those of you who are interested:

These 2 articles help me started.
http://support.microsoft.com/kb/q190605/
https://www.experts-exchange.com/questions/20422127/Data-Environment-Command.html

Only thing I need to know now is how to get rid of the username & password prompt.
Everytime I want to print I have to fill in the password.
How can I hard code this?
ASKER CERTIFIED SOLUTION
Avatar of DennisPost
DennisPost
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think the links in this question could be of great help for those who are getting started in this subject.
Close but do not delete might be a better option.
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator