3 Replies Latest reply: Sep 18, 2009 4:43 PM by Ludek Uher RSS

Report Selection Formula

Ruan De Villiers
Currently Being Moderated

Hi All...

 

Recently i Upgraded my Crystal Reports R2 from Service pack 1 to ServicePack 4 but so far i am regretting it all the way. I hope that you guys can please help me with some answers as to this question.

 

Previously the report worked 100% but since i upgraded it looks like the Record Selection Formula does not get send through to the reportDocument anymore. Can you please help me and tell me how i can fix this problem. When the report displays on the page i see all the info in the database since day 1.

 

My Settings looks as follow.

 

Development PC:

Operating System : Windows XP

Development Enviroment : Visual Studio 2005 (VB.Net)

Crystal Reports Version : CR XI R2

 

Application Type : Desktop Application

 

Code:

 

'Global Variable Declaration

 

 

Public rd As New ReportDocument

 

'Function that generates the Selection Formula and display the report

 

Public Sub BuildReport()

 

Try

 

Dim sSql As String = ""

 

Select Case Me.sFunction

 

Case "GoodsRecievedNote"

 

sSql = "{tblGoodsRecievedNotes.GoodsRecievedNoteNumber}='" & sDocNumber & "'"

 

Cursor = Cursors.WaitCursor

 

rd.Load(Path.GetFullPath(Application.StartupPath & "\rptGoodsRecievedNote.rpt"))

 

rd.RecordSelectionFormula = sSql

 

rd.Refresh()

 

Case "Quotation"

 

sSql = "{tblQuotations.QuoteNumber}='" & sDocNumber & "'"

 

Cursor = Cursors.WaitCursor

 

rd.Load(Path.GetFullPath(Application.StartupPath & " \rptQuotation.rpt"))

 

rd.RecordSelectionFormula = sSql

 

rd.Refresh()

 

End Select

 

Me.crView.ReportSource = rd

 

Me.crView.Zoom(85)

 

Cursor = Cursors.Arrow

 

Catch ex As Exception

 

ReportError(ex.ToString, Err.Description)

 

End Try

 

End Sub

  • Re: Report Selection Formula
    Ludek Uher
    Currently Being Moderated

    See if the following will help resolve the issue:

     

     

    Expand Form1.vb|cs to show Form1.Designer.vb|cs.

    Double-click on Form1.Designer.vb|cs to show it's code.

    In the InitializeComponent method, you will find code where the CrystalReportViewer1 properties are set.

    Comment out or delete the following two lines:

    this.crystalReportViewer.SelectionFormula = ""

     

    this.crystalReportViewer.ViewTimeSelectionFormula = ""

     

     

     

    Ludek