SQL Server Performance Forum – Threads Archive
Custom Code errorsHey,
I’m having problems getting my custom code to work in RS. There is minimal explanation in BOL, but I’ve tried to do something very simple to see if it works, with no luck. Here is the Custom code: Function ReturnVal(myNumber AS Integer) AS Integer
Dim intNumer AS integer
intNumber = myNumber + 4
In my report I have a field that is currently returning an integer value ( =Fields!total_hours.Value ) now, as a test, I created another field and the exppression is
=Code.ReturnVal(Fields!total_hours.Value) I am hoping the number will be 4 more than the original.
This is the error I recieve when i try to preview: : [BC30451] Name ‘intNumber’ is not declared. Any suggestion about where else I need to declare this variable besides within my code block ? thanks a ton! Doug
You have a typo in your code [<img src=’/community/emoticons/emotion-1.gif’ alt=’‘ />] <br />"Dim intNumer AS integer" should be "Dim intNumber AS integer" <br />You can write this as <pre>Function ReturnVal(myNumber AS Integer) AS Integer<br />Return (myNumber + 4)<br />End Function</pre> <br /><br />HTH<br /><br />Jasper Smith
don’t i feel stupid.
thanks and sorry ![:I]