Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error in formula <Record_Selection> This field name is not known.

I'm have a very frustrating time getting this report to work.

Version CR: 11.5 R2A SP6 (11.5.3700)

I am adding a new report to a well established application developed in VB 2005.

The application is using the CR SDK to accomplish most things.

My form (crptInsulationReportSummary) is connected to a SQL Server 2008 data source.

While in development mode I can select the "Main Report Preview" tab and see that the report is connected properly and that data shows up in the report.

When the application is run the following occurs in the order presented:

clsInsulationReportSummary.InitializeDataSet()

call PrintInsulationReportSummary()

     CrystalReportsHelper.DatabaseIntializationLion

     InsulationSummaryReport.RecordSelectionFormula = ...

     InsulationSummaryReport.SetDataSource( ...

The code for the above routines is pasted below.

It seems very simple and straightforward, however no matter what I try (I've even deleted the report and started from scratch) I keep getting the following error depicted in the image below.

I'm not getting an error, per se, just a blank report, but when I dig through the object this is what I find.

Let me know if you need any more information.

Thank you.

Tim Caldwell



(contents for above calls)

Public Class clsInsulationReportSummary

    Public Shared dsInsulationReportSummary As DataSet

    Public Shared Sub InitializeDataSet()

        dsInsulationReportSummary = New DataSet

        dsInsulationReportSummary.Tables.Add("vBOMInsulationReportSummary")

    End Sub

  End Class

    Private Sub PrintInsulationReportSummary()

        Dim InsulationSummaryReport As CrystalDecisions.CrystalReports.Engine.ReportDocument

        InsulationSummaryReport = New crptInsulationReportSummary

        Try

            CrystalReportsHelper.DatabaseIntializationLion(InsulationSummaryReport)

            InsulationSummaryReport.RecordSelectionFormula = " ({vBOMInsulationReportSummary.head_order_nbr} = 'SDJ120123-17')"

            InsulationSummaryReport.SetDataSource(clsInsulationReportSummary.dsInsulationReportSummary.Tables.Item("vBOMInsulationReportSummary"))

        Catch ex As Exception

            MessageBox.Show("Error Generating Report: StackTrace:" & ex.StackTrace())

        End Try

        Dim CrystalReportViewerForm As New frmCrystalReportViewer

(set break point here)          CrystalReportViewerForm.CrystalReportViewer1.ReportSource = InsulationSummaryReport

        ETIBomBlowerGlobalFunctions.LogReport(InsulationSummaryReport)

        CrystalReportViewerForm.Show() 'With Logging

        InsulationSummaryReport = Nothing

    End Sub

Public Class CrystalReportsHelper

    Shared Function DatabaseIntializationLion(ByRef Rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument) As Boolean

        Dim crtableLogoninfos As New TableLogOnInfos()

        Dim crtableLogoninfo As New TableLogOnInfo()

        Dim crConnectionInfo As New ConnectionInfo()

        Dim CrTables As Tables

        Dim CrTable As Table

        With crConnectionInfo

            .ServerName = "Lion"

            .DatabaseName = "QWright"

            .UserID = "xxxxxxxxxx" (x'd out for security)

            .Password = "xxxxxxxxxx" (x'd out for security)

        End With

        CrTables = Rpt.Database.Tables

        'Loop through each table in the report and apply the

        'LogonInfo information

        For Each CrTable In CrTables

            Select Case CrTable.Name

                Case "vENG_BomGen_LineDetail", _

                     "vENG_BomGen_Costing", _

                     "vENG_BomGen_Costing_Forecast", _

                     "vLineDetailInnerJoinBomGenCosting", _

                     "vLineDetail", _

                     "vCoilAttributes", _

                     "vBOMInsulationReportSummary"

                    crtableLogoninfo = CrTable.LogOnInfo

                    crtableLogoninfo.ConnectionInfo = crConnectionInfo

                    CrTable.ApplyLogOnInfo(crtableLogoninfo)

            End Select

        Next

        Return True

    End Function

Tags:
Former Member
replied
Not what you were looking for? View more on this topic or Ask a question