Match contents of 2 textbox using Expression

  • I have 2 testbox values that need to be validated before printing.My expression is :

    IIF(Fields!A.Value.ToString = Fields!B.Value.ToString,

    Fields!A.Value, Fields!A.Value & " " & Fields!B.Value)

    I want the expression to validate if Value of Txt Box A & B is the same,if yes only print Txt Box A else Print Txt Box A Txt Box B.

    Im not able to compare the both values,

    while preview of report I receive error message "Input String was not in correct format"

    I have tried all of the following as well.

    IIF(Fields!A.Value.ToString = Fields!B.Value.ToString,

    Fields!A.Value, Fields!A.Value & " " & Fields!B.Value)

    IIF(Fields!A.Value.ToString LIKE "Fields!B.Value.ToString",

    Fields!A.Value, Fields!A.Value & " " & Fields!B.Value)

    IIF(Fields!A.Value.ToString LIKE Fields!B.Value.ToString,

    Fields!A.Value, Fields!A.Value & " " & Fields!B.Value)

    IIF(Fields!A.Value LIKE Fields!B.Value,

    Fields!A.Value, Fields!A.Value & " " & Fields!B.Value)

    IIF(Fields!A.Value LIKE UCase(Fields!B.Value),

    Fields!A.Value, Fields!A.Value & " " & Fields!B.Value)

    The example of Text Box A Value is = JOIN

    The example of Text Box B Value is = Join.

    Ive been trying this for a long time and can't seem to get it to work.Do help me out !!!!!!:crying:

    Thank You

  • I suspect you might need to check the data types of the fields, A and B, that you’re using.

  • I tried using a TRIM and changed both Text Box Values to Lower Case [LCase] and then compared them using the "LIKE".

    It works now 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply