cancel
Showing results for 
Search instead for 
Did you mean: 

Error when passing text values to Crystal Report Formula field from VB.Net

former_member689671
Discoverer
0 Kudos

I am trying to pass some text to a formula field in a Crystal Report. Formula field name is "txtShopName". shopName is a variable and it has the value of "TORCH-MINIMALL". I use VB.net to view the report and pass the parameter value as follows. However, I get an error when trying to view the report.(Image attached)

What could be the reason?. Is there any specific way which I have to create the formula field in the report?.

                Dim crepBill As New repBill
                crepBill.SetDatabaseLogon("sa", dbPwd)
                crepBill.DataDefinition.FormulaFields.Item("txtShopName").Text = shopName
                crepBill.RecordSelectionFormula = "{TB_SALES.bill_no} ='" & "B000002" & "'"
                CrystalReportViewer1.ReportSource = crepBill
                CrystalReportViewer1.Zoom(100)
                CrystalReportViewer1.Refresh()
                CrystalReportViewer1.RefreshReport()

DellSC
Active Contributor
0 Kudos

Which version of the SDK are you using?

former_member689671
Discoverer
0 Kudos

CRforVS13SP27_0-10010309

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Your single/double quotes don't match:

"{TB_SALES.bill_no} ='" & "B000002" & "'"

Use single quotes inside and wrap the whole thing in double quotes.

Something like this

"{TB_SALES.bill_no} = 'B000002'"

Don

Answers (0)