Why am I getting "Unrecognized identifier" in my SSRS custom code? - reporting-services

I'm trying to make use of the custom code feature within SSRS (SQL Server Reporting Services), but keep getting an "Unrecognized identifier" message in the Expression Editor.
Here's my custom code. Actually, the final routine will be more complicated than this, but I'm trying to simplify things to figure out why the error is happening.
Public Function GetCutoffDate(batchNumber As String) As DateTime
Return New DateTime(Now.Year, 12, 31)
End Function
Here's how I reference the code in the Expression Editor.
=IIf(UCase(Fields!MailId.Value) = "VARIOUS",
Code.GetCutoffDate(Fields!BatchNumber.Value),
Fields!CutOffDate.Value)
I'm getting a red underline under the "GetCutoffDate" portion of Code.GetCutoffDate(..). Also, the message "Unrecognized identifier" appears when I hover my mouse over the "GetCutoffDate" text.
What am I missing?
I've also tried the following in the Expression Editor but keep getting the same "Unrecognized identifier" message.
=Code.GetCutoffDate(Fiels!BatchNumber.Value)
I must be overlooking something, but can't see what it is.
Thanks.

Try
Public Shared Function GetCutoffDate(batchNumber As String) As DateTime ...
in the function declaration, which has worked for me.

Turns out my custom code would still work, despite getting the "Unrecognized identifier" message. I was getting confused because the dataset I had specified was return back zero records.
Still not sure why the "Unrecognized identifier" message comes up, though. Very annoying.

Related

Invalid Syntax Infinite Loop

In the Access query builder, as I am entering a formula, if there is a syntax error, I will get the usual error message stating "The expression you entered contains invalid syntax." The problem is, when I click "OK" the message comes back again, and again, and again. It it an infinite loop and the only way I have found to get out of it is filling MS Access in the task manager. Of course I lose all my unsaved work to that point.
Also happens for other syntax errors like "The expression you entered has an invalid string."
I am attaching screenshots for reference, but please do not get hung up on the syntax. I realize the syntax is not valid, it is the infinite loop of errors that results from them that is the issue.
Sample of Error
Sample of Error #2
This has been happening for a while now. Any help anyone could provide would be most appreciated.
PS. I tried this against an empty table with the same results. So it is not a case of Access trying to validate the syntax against all records in the table.

There was an error compiling this function. Access 2013 Calculated field issue

I have a table with a field which is of a calculated type and contains the following expression:
IIf(IsNull([OrderValue]),[TotalPhaseLabourCost]-[DefaultOrderValue],[TotalPhaseLabourCost]-[OrderValue])
For some reason when I go to open the table in any view it throws the error:
"There was an error compiling this function.
The Visual Basic module contains a syntax error.
Check the code, and then recompile it."
However, I have this database currently open on two laptops, one works fine and the other has this issue. I have checked both db's refs and they also match up.
That's a bit vague, so I can only make guesses.
Try to compile the code as the error message says.
check if you have any function with the same name as your field
Try replacing IIf(IsNull([OrderValue]), by IIf([OrderValue] is Null,
You probably miss the leading equal sign:
=IIf(IsNull([OrderValue]),[TotalPhaseLabourCost]-[DefaultOrderValue],[TotalPhaseLabourCost]-[OrderValue])
Or you could use:
=[TotalPhaseLabourCost]-Nz([OrderValue],[DefaultOrderValue])
For me there was some problem with some fields (it showed an error message #NAME? in some of the fields (date, number) in the 'new' record).
For me it worked to close the table, right-click it and open in design view.
For each of the fields with problems, I choose the data type (that was already shown) again from the drop down menu (so, same data type!).
Save.
Then it didn't give the error messages anymore.

Complie Error: Method or Data Member not found, but it does exist

Having a strange problem in vba access. I have a text control control called txtUserName on a form and am trying to get the contents which is all but child's play. When I try to run or complie, I get the Method or Data Member not found error. However, when I type me. Intellisense shows txtUserName. I have gone as far as copying and pasting the name from the control's properties and still get the error. What am I missing? I am completely perplexed.
Thanks in advance
Don
In this case, I was just building a SQL string. I did find the problem, there was a bad control reference, however, it was not the one that was highlighted (highlighted was the first value in an insert into string and it was actually the 3rd value)

MS Access VBA Compile Error on "x="

Everytime I try to compile my VBA code, I'm getting an error that says "Can't find project or library".
I have no idea which library I'm missing because all that the debugger highlights is a portion of one of my VBA lines:
x=
the full line looks like this:
x = MsgBox("You must select a manufacturer")
Any clues what library I need to include?
Thanks Hans,
I didn't notice that one of my references was labeled as "MISSING".
...
First thing to check: from VB Editor main menu, choose Tools->References. If any of the selected (checked) references are "Missing", all sorts of weird crap can happen with your code. Fix any that are missing

object required error

Can anyone tell me the reason for this error message in report manager? My report works fine in tool. My second parameter is cascaded (derived from) to the first parameter.
When I run the report for first time it works, but when immediately change any other parameter and try to execute it gives me no data in the result and the web page shows this error:
Line: 13
Char: 692
Error: Object Required
Code: 0
Why do I receive this error?
Sounds like Javascripts version of a NullReferenceException. If that is the case, there are a billion different reasons why this could happen.