Help code doesn't work anymore after upgading to ActiveReport 2.0

Posted by: bgw on 4 August 2017, 3:15 pm EST

  • Posted 4 August 2017, 3:15 pm EST

    I have a section of code that dynamically builds and binds controls on a report. It used to work fine in AR1 but since upgrading to AR2 it goes into a endless loop when executing the run method on the report

    %%%%%% Code Follows %%%%%%%%

    With DetSection.Controls

    Set ctl = .Add("DDActiveReports.Field")

    ctl.Name = Prefix & "Field" & iCount

    ctl.Top = iTop

    ctl.Width = fld1.Width

    ctl.Left = iPos

    ctl.Height = fld1.Height

    ctl.DataField = oField.Name

    ' ctl.DataSource = fld1.DataSource

    ctl.OutputFormat = FormatFieldValue(oField.Type)

    If IsNumericType(oField.Type) Then

    ctl.Alignment = ddTXRight

    ElseIf IsDateType(oField.Type) Then

    ctl.Alignment = ddTXCenter

    ElseIf IsDateType(oField.Type) Then

    ctl.Alignment = ddTXLeft

    End If

    ctl.Width = CurrWidth



    End With

    %%%%%%%%%%%%%%%%%%%%%

    I suspect it has something to do with the datacontrol being commented out. All references to DDActiveReports have been updated to DDActiveReports2. All project references to. Please help I've been chasing my tail for 2 days.
  • Replied 4 August 2017, 3:15 pm EST

    Hello,

    Thank you for your query. In order to resolve the same, please consider counting the number of fields in the datasource and adding fields accordingly. Please take a look at the attached sample in this regard.

    Regards,
    Prantik


    2009/06/Fieldsaccordingtodataindatabase.zip
Need extra support?

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

Learn More

Forum Channels