Error Data Report Group Footer VB6

1

Oops!

I need to add one more field in a vb6 report report as in the image

The connection to the bank is done via ODBC Driver 5.1 with MySQL database. I use this SQL for report generation:

SELECT *, venda.TotalS AS total_venda_agrupa, venda.totalc AS valor_total_venda, venda_forma_pagamento.descricao AS nome_forma_pagamento, vendaesc.QUANTIDADEprod as qtd, (vendaesc.QUANTIDADEprod * vendaesc.ValUniProd) As total_soma  FROM vendaesc,venda INNER JOIN venda_forma_pagamento ON venda_forma_pagamento.cod = venda.forma_pagamento where vendaesc.data='2016-03-30' AND venda.cod = vendaesc.venda   order by venda.cod

What it does is just relate the tables and bring the data, simple thing.

The new field is a RptFunction of the data report components. Before trying to add this field, the report did not have any Header / Footer Group, it was necessary to add to the new field not to be in the list of report items and to be below each list group.

Adding this group started to give this error,

report section do not match data source

Someone knows how to solve this, what's wrong?

    
asked by anonymous 30.03.2016 / 17:25

1 answer

1

Try to adapt to use SHAPE APPEND like this:

If RSTest Is Nothing Then
    Set RSTest = New ADODB.Recordset
End If
If RSTest.State = adStateOpen Then
    RSTest.Close
End If


'Two tables
SQL = "SHAPE {SELECT vendaesc.venda as venda,vendaesc.tipo as tipo,vendaesc.prod as prod, vendaesc.ValUniProd as valuniprod, vendaesc.QUANTIDADEprod as qtd, (vendaesc.QUANTIDADEprod * vendaesc.ValUniProd) As total_soma  FROM vendaesc} AS Level1 " & _
        "APPEND ({SELECT venda.forma_pagamento_detalhe_nome as forma_pagamento_detalhe_nome,venda.forma_pagamento_parcelas as forma_pagamento_parcelas, venda.TotalS AS total_venda_agrupa, venda.totalc AS valor_total_venda, venda_forma_pagamento.descricao AS nome_forma_pagamento from venda INNER JOIN venda_forma_pagamento ON venda_forma_pagamento.cod = venda.forma_pagamento where venda.cod = vendaesc.venda order by venda.cod } AS Level2 " & _
            "RELATE venda.cod to venda.cod)"

RSTest.Open SQL, gConexao, adOpenStatic, adLockOptimistic
Set RptFPagamentoDetalhe.DataSource = RSTest


With RptFPagamentoDetalhe.Sections("Section1").Controls
    .Item("Text2").DataMember = "Level1"
    .Item("Text2").DataField = "venda"

    .Item("Text1").DataMember = "Level1"
    .Item("Text1").DataField = "tipo"

    .Item("Text3").DataMember = "Level1"
    .Item("Text3").DataField = "prod"

    .Item("Text4").DataMember = "Level1"
    .Item("Text4").DataField = "qtd"

    .Item("Text6").DataMember = "Level1"
    .Item("Text6").DataField = "ValUniProd"

    .Item("txtTotal").DataMember = "Level1"
    .Item("txtTotal").DataField = "total_soma"

    .Item("Text5").DataMember = "Level2"
    .Item("Text5").DataField = "nome_forma_pagamento"

    .Item("Text7").DataMember = "Level2"
    .Item("Text7").DataField = "forma_pagamento_detalhe_nome"

    .Item("Text8").DataMember = "Level2"
    .Item("Text8").DataField = "forma_pagamento_parcelas"
End With

I'm returning empty data filed

    
30.03.2016 / 19:34