MS Reporting Services Currency Variable Type

Posted on 2005-04-28
Last Modified: 2008-01-09


I've put a function in the report parameters code section where I want to set the value of some currency to 0.00 depending on the value from another field which has been passed in. It's wrapped inside a sum function in the expression so that only my revenues from product are calulated within the headers in each of my groups. Why can't I use the currency variable type inside of here? Next best thing is Double, but I'd rather show the exact amounts, plus i'd like to understand what's going on here. Here is there error I get when I try to use Currency:

There is an error on line 1 of custom code: [BC30389] 'System.Currency' is not accessible in this context because it is 'Private'.

Here is the function I'm trying to use, double works no problem but rounds it off

Public Function getDollarValue(ByVal Value As String, ByVal Dollar As Double) As Double
  Dim rtnVal As Double
  If Value = "Discount" Then
    rtnVal = 0.00
  ElseIf Value = "Freight" Then
    rtnVal = 0.00
  ElseIf Value = "Tax" Then
    rtnVal = 0.00
    rtnVal = Dollar
  End if

  Return rtnVal
End Function

thanks in advance
Question by:animated405
    LVL 14

    Expert Comment

    Not sure on the error message, but couldn't you use an expression within the textbox to determine what value is displayed?

    Something like:


    Or you could use the SWITCH function (­ary/en-us/vblr7/html/vafctswit­ch.asp )

    Author Comment


    I figured you could but I wasn't getting the syntax correct for multiple statements because I didn't think you could just put several iif's together like that. I'm going to give that a shot

    Author Comment


    thanks, that works for a field where the value is a number, but I'm getting this error when I try to do it with the currency

    The value expression for the textbox ‘textbox16’ uses an aggregate function on data of varying data types.  Aggregate functions other than First, Last, Previous, Count, and CountDistinct can only aggregate data of a single data type.

    my field is returned is money, why would it think that the rows contain varying data types?? I've tried changing the properties of the field in the report but to no avail
    LVL 14

    Accepted Solution

    Can you post the expression your using within the textbox?

    MS stated this with regard to the error your getting:

    " It is up to the data provider (e.g. managed SQL provider) how it translates database types into .NET datatypes. Generally, you can determine the runtime datatype of fields by temporarily adding a textbox to the report which shows the runtime datatype:
    =First(Fields!SomeFieldName.Va­lue, "DataSetName").GetType.ToStrin­g "

    LVL 100

    Expert Comment

    Thanks  animated405 for closing this question

    Reporting Tools Page Editor

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Hi, I am very much excited today since I'm going to share something very exciting Tool used for Analytical Reporting and that's nothing but MICROSTRATEGY. Actually there are lot of other tools available in the market for Reporting Such as Co…
    Hello, In my precious Article  ( saw the Configuration part for Microstrategy which included Metadata Creation and DataSource Preparation as …
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now