Solved

Getting specific field in CrystalReports (shorthand)

Posted on 2003-11-25
9
260 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Concatenate 2 userform comboboxes to a userform text box 4 56
SSRS expression Issue finding a string 10 65
VBA error replacing data 6 36
vbModal 12 31
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

930 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

6 Experts available now in Live!

Get 1:1 Help Now