Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with selection formula

Status
Not open for further replies.

ribbons

Technical User
Apr 26, 2007
113
US
I'm using VB.NET 2005 and CR XI. I am trying to filter a CR report with a selection formula as below:

Code:
 Dim selectionFormula As String = "{LabNumber.OldLabnumber} = " & cmblabnumber.Text

cmblabnumber is a drop down box

I'm new to .NET and am following a published example from MSDN with a few variations, but apparently, I am omitting some formatting from this string. I am using a drop down box filled with lab numbers to filter the form to show only the lab number selected. This looked so easy, but the error message on run says
Code:
 "A string is required here"

Any ideas?
 
try this:
Code:
if Not String.isNullOrEmpty(cmblabnumber.Text) then
   Dim selectionFormula As String = "{LabNumber.OldLabnumber} = " & cmblabnumber.Text
end if



-The answer to your problem may not be the answer to your question.
 
Nope, it doesn't like that either. I suspect that I have some syntax wrong. I intend to have several drop down boxes that will filter this form and the syntax example I'm following is (this is from MSDN):

Code:
Dim selectionformula As String = "[Customer.Last year's Sales} > ' _
& salesAmount _
& " AND Mid({Customer.Customer Name}, 1, 1) " _

and so forth. Do I have some of the quotes in the wrong place or something like that??
 
you will probably need square brackets around "Customer Name" because it has a space in it.

you may want to just copy paste your code, because your brackets aren't matching up.

-The answer to your problem may not be the answer to your question.
 
Am I on the right track here when I assume that in order to create a selectionformula for the displayed report, that I do not HAVE to use SQL, that I can use the filter syntax, such as:

Code:
"{Table.field} =" combobox.Text & "Table.field2} =" combobox2.Text &

Can I use SQL? I am familiar with that from VB6
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top