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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Mid in an expression

Status
Not open for further replies.

sparkey75

Technical User
Nov 9, 2009
4
GB
I am trying to use Mid() in an expression:

Mid(Fields!JOB.Value,4,3 <> "999")

When I run the report, I get the following error:

[rsRuntimeErrorInExpression] The Value expression for the textbox ‘Textbox1’ contains an error: Argument 'Length' must be greater or equal to zero.

Any advice on resolving this would be most appreciated. Many thanks.
 
Mid returns a substring of the string you are referring to so you need to wrap it in an iif statement:

=IIF(Mid(Fields!JOB.Value,4,3) <> "999","It's Not 999","999")

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Specifically to your error; since you did not place your closing parenthesis after the 3, the Mid function was attempting to evaluate 3 <> "999" as its third, or Length, argument which must evaluate to an integer. 3 <> "999" evaluates to a Boolean value.

Unless your expression is used in a property that accepts a Boolean value, you'll most likely need to use it as xlbo suggests.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top