"Object variable or With block variable not set"

  • Hi all, I'm getting the following error:

    The Hidden Expression for the text box "Example" contains an error: Object variable or With block variable not set.

    I've Googled the issue and I see what it is trying to say, but for the love of me I do not understand why. Here is the code I'm including in my visibility expression:

    =IIF((First(Fields!SHIPTO.Value, "ShipToPayer") = First(Fields!payer.Value, "ShipToPayer")

    AND (First(Fields!UserRole.Value, "Role") = 1)),False,True)

    It's not a difficult bit of code. From trial and error I have determined that it is the second part it does not like (UserRole = 1). I truly do not see what the problem is. The report is determining Role by looking at the UserID and matching that up against the DataSet I created to get UserID and Role, honestly it's not a complicated structure. If anyone can help with this I would greatly appreciate it.

  • All I can offer is my debug mechanism. Maybe it'll spark you on your way.

    #1 Change all first() expressions with a static text or number.

    Make sure that works.

    Then add one first() at a time untill you hit the error. Once you know for sure where it fails I'll possibly be able to throw more ideas out, but for now that's all I got.

  • I've already troubleshot (boy that word sounds weird) to the point where I know it's the “First(Fields!UserRole.Value, "Role") = 1” piece of code, I just don’t understand why.

  • What happens if you use that expression in a columnn?

    Not the IIF, but just the first()?

  • Ok, this is just weird. I just created a new text box, pasted the exact same code into it, and it works fine... I've looked through every setting option in the entirety of the text boxes, nothing is different. Something must have gotten screwed up in the XML code or something... and I do not have the pure strength of will to go through the XML code to find out what. Thanks for your help guys.

  • makes no sens but it's erhm working...

    happy hunting.

Viewing 6 posts - 1 through 6 (of 6 total)

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