Solved

Getting specific field in CrystalReports (shorthand)

Posted on 2003-11-25
9
259 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now