• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

Getting specific field in CrystalReports (shorthand)

Is there a shorthand method of doing similar to below...

Database.Tables.Item(1).Fields.Item(31).Value

Item 31 is the email field.  I want to specify the field name instead of doing a loop beforehand to get the item number (In case I add a field later).

Similar to rsRecordset("Email")
0
ketapillar
Asked:
ketapillar
1 Solution
 
magnus23Commented:
Hi ketapillar
I believe this will work
Database.Tables.Item(1).Fields!Email
0
 
ketapillarAuthor Commented:
Nope...  Doesn't work :(
0
 
mlmccCommented:
Which version and edition of CR?

Which method of displaying the report?  RDC?

This used to work but I think in the later versions it was deleted
Database.Tables.Item(1).Fields("Email ")

mlmcc
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ketapillarAuthor Commented:
I'm using version 9 and RDC.

The Database.Tables.Item(1).Fields("Email ") doesn't work either...
0
 
ketapillarAuthor Commented:
Increased pointz
0
 
ketapillarAuthor Commented:
PAQ with this as answer

'This function returns the value within a database field.
'   Created 2003/11/26  brr
Public Function GetDBFieldValue(strFieldName As String, Optional intDatabaseNumber As Integer) As Variant
    Dim x As Integer
   
    If intDatabaseNumber < 2 Then intDatabaseNumber = 1
   
    For x = 1 To Database.Tables.Item(intDatabaseNumber).Fields.Count
        If UCase(Database.Tables.Item(intDatabaseNumber).Fields.Item(x).Name) = UCase("{pvwMembersC." & strFieldName & "}") Then
            GetDBFieldValue = Database.Tables.Item(intDatabaseNumber).Fields.Item(x).Value
            Exit Function
        End If
    Next x
End Function
0
 
amp072397Commented:
PAQed, with points refunded (100)

Thanks very much!
amp, ee admin, amp*at*experts-exchange.com
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now