on 07-15-2020 10:18 AM
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()
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.