How do you pass a selection formula to a report from within VB? I have a report that will not accept my formula, and instead returns all records. I am using SQL Server as the back end, and some of the tables and fields are separated by spaces.
The table.fieldname is:
Active_Ops_View.Responsible Manager/Staff
In SQL Server it would be:
Active_Ops_View.[Responsible Manager/Staff]
Here is my VB code for the formula:
Dim my_formula As String
my_formula = "" + "{Active_Ops_View.Responsible Manager/Staff} = " + "'" + Trim(cboStaff3.Text) + "'" + ""
myReports.ReportFileName = App.Path & "\report1.rpt"
myReports.SelectionFormula = myformula
myReports.PrintReport
pnlManager.Visible = False
Why doesn't this work? I have done this in another report, and it works fine. However, the fields don't have spaces in the other report.
The table.fieldname is:
Active_Ops_View.Responsible Manager/Staff
In SQL Server it would be:
Active_Ops_View.[Responsible Manager/Staff]
Here is my VB code for the formula:
Dim my_formula As String
my_formula = "" + "{Active_Ops_View.Responsible Manager/Staff} = " + "'" + Trim(cboStaff3.Text) + "'" + ""
myReports.ReportFileName = App.Path & "\report1.rpt"
myReports.SelectionFormula = myformula
myReports.PrintReport
pnlManager.Visible = False
Why doesn't this work? I have done this in another report, and it works fine. However, the fields don't have spaces in the other report.