subreports lost data

Posted by: cris28 on 4 August 2017, 3:14 pm EST

  • Posted 4 August 2017, 3:14 pm EST

    Hello,

    I have a vb6 application with 5 subreports and any subreports contain some scgrid that fill manually from another Form in the same project and it doesn't contain any datasource or connection:





    Public m_grid As SCGrid

    Set SubReport1.object = New rptCalcolo



    SubReport1.object.SCGrid1 = FrmCalcolo.SCGridCycle

    Set m_grid1 = FrmCalcolo.SCGridCycle



    SubReport1.object.SCGrid1.Rows = m_grid1.Rows

    SubReport1.object.SCGrid1.Cols = m_grid1.Cols

    SubReport1.object.SCGrid1.Width = m_grid1.Width

    SubReport1.object.SCGrid1.Height = m_grid1.Height



    For x = 0 To m_grid1.Cols - 1 'colonna

    For i = 0 To m_grid1.Rows - 1 'riga

    SubReport1.object.SCGrid1.Text(i, x) = m_grid1.Text(i, x)

    Next i

    Next x



    When I display a report, the subreport doesn't display any data.

    I don't understand what I'm doing wrong.

    If I insert an scgrid object on the main report (whith the same data) it works.



    Any help would be appreciated

    thank you
  • Replied 4 August 2017, 3:14 pm EST

    Hello Lia,



    If you see the grid displaying but not showing up, please try to set code as



    Mainreport.run false

    so that the report can properly buffer the data before displaying the same.



    Could you please send us a small sample replicating the issue that you encounter so that we can test it further at our end and come to a viable resolution?



    Regards,

    Prantik



  • Replied 4 August 2017, 3:14 pm EST

    Thanks for the help, but doesn't work :(





    1) What is FrmCalcolo in your project? Is it the main form?



    yes, FrmCalcolo is the main Form.





    2) Where in your main report are you placing the subreport?



    I place the subreport in Detail section





    3) Where are you placing the SCGrid in your subreport? If placed somewhere else please consider placing the same in the detail section.





    I also have place SCGrid in Detail section.



    I try to place the code in two diferent methods:





    1) I place the code on on_click button in the Main Form but I have the same results, the ScGrid is empty, but the property like Rows, Cols, Height, Width are ok.





    In the Main form on_click button:



    Public m_grid As SCGrid



    Set m_grid1 = FrmCalcolo.SCGridCycle

    Dim rpt as new rptCalcolo



    rpt.SCgrid1= FrmCalcolo.SCGridCycle

    rpt.SCGrid1.Rows = m_grid1.Rows

    rpt.SCGrid1.Cols = m_grid1.Cols

    rpt.SCGrid1.Width = m_grid1.Width

    rpt.SCGrid1.Height = m_grid1.Height

    For x = 0 To m_grid1.Cols - 1 'colonna

    For i = 0 To m_grid1.Rows - 1 'riga

    rpt.SCGrid1.Text (i, x) = m_grid1.Text (i, x)

    Next i

    Next x

    MainReport.subreport1=rpt





    In Main Report I have a subreport place in Detail section : subreport1



    In SubReport I place the ScGrid in detail section: ScGrid1





    2) on_click button in the Main Form I call the MainReport.Show



    I place the code in the Main Report like





    Public m_grid1 As SCGrid

    Dim rpt As New rptCalcolo



    Private Sub ActiveReport_ReportStart()



    Set m_grid1 = FrmCalcolo.SCGridGeometry

    rpt.SCGrid1 = FrmCalcolo.SCGridGeometry

    rpt.SCGrid1.Rows = m_grid1.Rows

    rpt.SCGrid1.Cols = m_grid1.Cols

    rpt.SCGrid1.Width = m_grid1.Width

    rpt.SCGrid1.Height = m_grid1.Height



    end sub





    Private Sub ActiveReport_FetchData(eof As Boolean)



    For x = 0 To m_grid1.Cols - 1 'colonna

    For i = 0 To m_grid1.Rows - 1 'riga

    rpt.SCGrid1.Text(i, x) = m_grid1.Text(i, x)

    Next i

    Next x



    End Sub





    Private Sub Detail_Format()



    Me.SubReport1 = rpt



    End Sub



    ... the same, the ScGrid it's empy but the property rows, cols ecc are ok.



    I really don't understand what's happend.



    thanks a lot for the help

    Lia
  • Replied 4 August 2017, 3:14 pm EST

    Thanks for the help, but doesn't work :(





    1) What is FrmCalcolo in your project? Is it the main form?



    yes, FrmCalcolo is the main Form.





    2) Where in your main report are you placing the subreport?



    I place the subreport in Detail section





    3) Where are you placing the SCGrid in your subreport? If placed somewhere else please consider placing the same in the detail section.





    I also have place SCGrid in Detail section.



    I try to place the code in two diferent methods:





    1) I place the code on on_click button in the Main Form but I have the same results, the ScGrid is empty, but the property like Rows, Cols, Height, Width are ok.





    In the Main form on_click button:



    Public m_grid As SCGrid



    Set m_grid1 = FrmCalcolo.SCGridCycle

    Dim rpt as new rptCalcolo



    rpt.SCgrid1= FrmCalcolo.SCGridCycle

    rpt.SCGrid1.Rows = m_grid1.Rows

    rpt.SCGrid1.Cols = m_grid1.Cols

    rpt.SCGrid1.Width = m_grid1.Width

    rpt.SCGrid1.Height = m_grid1.Height

    For x = 0 To m_grid1.Cols - 1 'colonna

    For i = 0 To m_grid1.Rows - 1 'riga

    rpt.SCGrid1.Text (i, x) = m_grid1.Text (i, x)

    Next i

    Next x

    MainReport.subreport1=rpt





    In Main Report I have a subreport place in Detail section : subreport1



    In SubReport I place the ScGrid in detail section: ScGrid1





    2) on_click button in the Main Form I call the MainReport.Show



    I place the code in the Main Report like





    Public m_grid1 As SCGrid

    Dim rpt As New rptCalcolo



    Private Sub ActiveReport_ReportStart()



    Set m_grid1 = FrmCalcolo.SCGridGeometry

    rpt.SCGrid1 = FrmCalcolo.SCGridGeometry

    rpt.SCGrid1.Rows = m_grid1.Rows

    rpt.SCGrid1.Cols = m_grid1.Cols

    rpt.SCGrid1.Width = m_grid1.Width

    rpt.SCGrid1.Height = m_grid1.Height



    end sub





    Private Sub ActiveReport_FetchData(eof As Boolean)



    For x = 0 To m_grid1.Cols - 1 'colonna

    For i = 0 To m_grid1.Rows - 1 'riga

    rpt.SCGrid1.Text(i, x) = m_grid1.Text(i, x)

    Next i

    Next x



    End Sub





    Private Sub Detail_Format()



    Me.SubReport1 = rpt



    End Sub



    ... the same, the ScGrid it's empy but the property rows, cols ecc are ok.



    I really don't understand what's happend.



    thanks a lot for the help
  • Replied 4 August 2017, 3:14 pm EST

    Hello,



    Could you please let us know:-



    1) What is FrmCalcolo in your project? Is it the main form?

    2) Where in your main report are you placing the subreport?

    3) Where are you placing the SCGrid in your subreport? If placed somewhere else please consider placing the same in the detail section.



    Please take a look at the modified code below and check if this helps.



    Public m_grid As SCGrid

    Set m_grid1 = FrmCalcolo.SCGridCycle

    Dim rpt as new rptCalcolo

    rpt.SCgrid1= FrmCalcolo.SCGridCycle

    rpt.SCGrid1.Rows = m_grid1.Rows

    rpt.SCGrid1.Cols = m_grid1.Cols

    rpt.SCGrid1.Width = m_grid1.Width

    rpt.SCGrid1.Height = m_grid1.Height

    For x = 0 To m_grid1.Cols - 1 'colonna

    For i = 0 To m_grid1.Rows - 1 'riga

    rpt.SCGrid1.Text (i, x) = m_grid1.Text (i, x)

    Next i

    Next x

    subreport1=rpt



    If this does not help please send us a small sample that we can analyze and find a proper resolution.



    Regards,

    Prantik

  • Replied 4 August 2017, 3:14 pm EST

    Hello Prantik ,

    thanks once again for the quick reply.

    I set the MainReport.Run False but unfortunately there are no change and I obtain the same results.

    I hope I'll post you the sample this week-end because the aplication it's too big and I have to change it to make it smaller.



    I thank you really very much for your help



    Regards

    Lia

  • Replied 4 August 2017, 3:14 pm EST

    Hello Lia,



    I apologize for the delay in response. On running the project, it asks for the following ocx



    giDataBoxVb6.ocx

    giRollImageVb6.ocx

    crystal32.ocx

    crydtc.ocx



    I tried to download the ocx but was unable to use them. Could you provide these ocx as well?



    Regards,

    Prantik

  • Replied 4 August 2017, 3:14 pm EST

    Hello Lia,



    We would be waiting for the sample.



    Regards,

    Prantik

  • Replied 4 August 2017, 3:14 pm EST

    Sorry,

    I forgot the ocx :) ... this is the scgrid.ocx that I use in the project.



    thank you

    regards,

    Lia


    2009/04/SCGrid.rar
  • Replied 4 August 2017, 3:14 pm EST

    Hello Lia,



    I tried to test the sample you sent by downloading the scgrid.ocx from the web. But unfortunately I was unable to run the project. Could you tell me which OCX and lib,I need to use or if possible can you send us the same?



    Regards,

    Prantik

  • Replied 4 August 2017, 3:14 pm EST

    Hi Prantik,

    here is a small project whith the scgrid example.



    thank you.



    I try another way , to create dynamic column and rows and It work's but I can't Keep together the rows(multiple lines) in the detail section. I'll post the code:



    Private Sub ActiveReport_DataInitialize()

    iLeft= 0

    i = 1

    Fields.RemoveAll

    While Not AdoFrm.Recordset.eof

    If i < 7 Then

    Set ctl = Me.Sections("PageHeader").Controls.Add("DDActiveReports2.field")

    ctl.Left = iLeft

    ctl.Top = 0

    ctl.Width = i + 1500

    ctl.Text = AdoFrm.Recordset.Fields(i).Name





    Set ctl = Me.Sections("Detail").Controls.Add("DDActiveReports2.field")

    ctl.Left = iLeft

    ctl.Top = 0

    ctl.Width = i + 1500

    Fields.Add ctl.Name

    ctl.DataField = AdoFrm.Recordset.Fields(i).Name



    iLeft = iLeft + ctl.Width + 344

    PrintWidth = iLeft



    i = i + 1

    End If

    AdoFrm.Recordset.MoveNext

    Wend

    End Sub



    Lia
    2009/04/Cacolo.rar
  • Replied 4 August 2017, 3:15 pm EST

    It's ok, don't worry, I thank you for response.

    I have started from a big application and I forgot to delete the components, in this case we need just the scgrid.ocx.



    Here is the application.



    regards

    Lia
    2009/04/Calcolo.rar
  • Replied 4 August 2017, 3:15 pm EST

    Lia,



    We are able to run the project and verify your issue. We need to investigate further to get a resolution to this. Thank you for keeping your patience with us.



    Regards,

    Prantik



  • Replied 4 August 2017, 3:15 pm EST

    thank you very very much Prantik!

    Now I understand , I would never have solved without you.



    Sorry for my english..



    have a good day

    Regards

    Lia













  • Replied 4 August 2017, 3:15 pm EST

    Hello Lia,



    Please consider writing the code to populate the data into the SCGRID of the subreport (rptcalcolo) in the detail_beforeprint event of the same .Please take a look at the attached sample where this is implemented and we get proper display.



    Regards,

    Prantik




    2009/04/Calcolo.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels