Solved

Getting specific field in CrystalReports (shorthand)

Posted on 2003-11-25
9
261 Views
Last Modified: 2010-05-01
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
Comment
Question by:ketapillar
9 Comments
 
LVL 3

Expert Comment

by:magnus23
ID: 9819716
Hi ketapillar
I believe this will work
Database.Tables.Item(1).Fields!Email
0
 
LVL 3

Author Comment

by:ketapillar
ID: 9820921
Nope...  Doesn't work :(
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9820960
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 3

Author Comment

by:ketapillar
ID: 9824910
I'm using version 9 and RDC.

The Database.Tables.Item(1).Fields("Email ") doesn't work either...
0
 
LVL 3

Author Comment

by:ketapillar
ID: 9824936
Increased pointz
0
 
LVL 3

Author Comment

by:ketapillar
ID: 10285247
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
 

Accepted Solution

by:
amp072397 earned 0 total points
ID: 10618848
PAQed, with points refunded (100)

Thanks very much!
amp, ee admin, amp*at*experts-exchange.com
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

810 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