Error Data Report Group Footer VB6

Asked

Viewed 145 times

1

Opa!

I need to add an extra field in a vb6 data report as in the image

inserir a descrição da imagem aqui

Connection to the database is done via ODBC Driver 5.1 with Mysql database. 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 had no Header/Footer Group, it was necessary to add to the new field not to be in the list of items in the report but below each list group.

When adding this group, started giving this error,

report section do not match data source

Some know how to solve this, what’s wrong?

1 answer

1

Try to adapt for use of 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

Ta me returning data Filed Empty

Browser other questions tagged

You are not signed in. Login or sign up in order to post.