Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing Dataset members from within custom code

Status
Not open for further replies.

HouGeek

Programmer
Apr 30, 2008
2
US
I've got a function in custom code called for every line in a table that uses a case statement to return various values.

In some cases, a calculation is required. In other cases, a return of a value from another dataset is all that's.

Assuming the function is called from a field in a table linked to Dataset B, is there a way to reference a member of Datset A from within the code?

With the simplified function below (calculations are omitted for brevity), I get a build error "Reference to a non-shared member requires an object reference. I'm trying to figure out how to express the object reference (if possible).

Example:
Public Function GetValueForLine(RowName as String) as String
Select Case LCase(RowName)

Case "start date"
Return Fields!RptHdrData.start_date.Value

Case "end date"
Return Fields!RptHdrData.end_date.Value

Case "currency"
Return Fields!RptHdrData.currency_code.Value

Case Else
Return "Unknown"
End Select
End Function
 
It has been a while since I have worked with custom code, but I think you have to pass all of the fields you need as parameters to the function.
 
I've found that it's possible to pass the ReportItems collection and reference values of individual items which is fine for one-line datasets. I was hoping for something more elegant for traversing datasets with multiple rows.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top