cancel
Showing results for 
Search instead for 
Did you mean: 

How to get data from a field in Crystal Report - VB6

Former Member
0 Kudos

Hi everyone,

I'm using CR8.5 e VB6 and I'm need to get the value of a formula to a variable in VB6 but I don't know how.

Anyone could help me?

Thanks in advanced!

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Jorge

I moved the post to the SAP Crystal Reports - Legacy SDKs SCN Space. That means you are working with a really (and in this case really, really, really) old version of CR. This one has bee out od support for over 15 years(!). And it does not support any current Operating Systems either, or databases for that matter...

E.g.; I'm not sure if you want to use CR 8.5 at all. My recommendation would be the free "SAP Crystal Reports, Developer Version for Visual Studio .NET", which you can download from here;

Having said that, if you still want to go with CR 8.5, you will have to decide which SDK - there were three in CR 8.5; RDC, OCX, Print Engine APIs.

For the RDC, have a look at sample apps here:

Report Designer Component SDK COM Samples - Business Intelligence (BusinessObjects) - SCN Wiki

Unfortunately, that is all I have. To be honest, I barely remember how to load a report using any of those SDK. Way too much water under that bridge... The Developer Help file is probably installed on your dev computer along with CR 8.5, so use that. And then google may be your best friend.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Former Member
0 Kudos

Former Member
0 Kudos

Ludek Uher


It's me again.


I'm trying to make some changes in the code I found in the link you sent above but I didn't get the point.


Can you take a look on my code?


When I run nothing happens, no msgbox...


The original code was about datafield and I have a formulafield.


Thanks in advanced!


Dim WithEvents crxSection As CRAXDRT.Section

Private Sub CrxSection_Format(ByVal pFormattingInfo As Object)

''Loop through the Report Objects in the Details sections

i = 1

'    'Check to see if the Report Object  is a Field Object

    If crxSection.ReportObjects(i).Kind = crFieldObject Then

        'If it is a Field Object then set the Field Object variable to this Report Object

        Set CrxFieldObject1 = crxSection.ReportObjects(i)

'        'Check to see if the Field Object is a Database Field Object

        If CrxFieldObject1.Kind = crFormulaField Then  'crDatabaseField

'            'If it is a Database Field then set the Database Field Definition Object to this Field Object

            Set CrxFormulaFieldDefinition1 = CrxFieldObject1.Field

'            'Check the Name of the Database Field to see if it is the field that we want

            If CrxFormulaFieldDefinition1.FormulaFieldName = "test" Then  'DatabaseFieldName

                'If it is then display the Value of each of the values in this field in a message box.

                MsgString = CrxFormulaFieldDefinition1.Value

                MsgBox MsgString

            End If

        End If

    End If

 

End Sub

Private Sub Form_Load()

'Set our Report Object to open our Report with Saved Data

Set CrxReport = CrxApplication.OpenReport(App.Path & "\RptSD2.rpt")

'Set the Section variable to point to our Details Sections.

Set crxSection = CrxReport.Sections("HR")

'Tell the CrViewer control to view our Report object and then View the Report.

CRViewer1.ReportSource = CrxReport

CRViewer1.ViewReport

'Maximize our preview window

PreviewFrm.WindowState = vbMaximized

'Zoom the Preview window to show the report at 100%

CRViewer1.Zoom 100

End Sub

former_member183750
Active Contributor
0 Kudos

No message box or no string in the message box? If you step through the code, does it ever get to the message box line? If not, where doe it stop?

- Ludek

Former Member
0 Kudos

No message box box appers.

The message box only appers in the original code but the original is about FieldObject and I'm trying to get a FormulaField.

When I make the changes nothing happens, just show the report but no message box

The original project: CR8_VB_RDC_Retrieve_Data

Thanks in advanced!!

0 Kudos

Hi Jorge,

If you comment out the Zoom line do you see data?

I think one of the problems may be dependencies on updated OS dll's, those methods may have problems going back to the way the RDC did things with newer usp10 and gdi.dll.

RDC is 10 years old and was never updated to support current OS's. I think Windows 7 was possibly the last version it may have supported.

You are using really old technologies and it's going to get tough to make things work, especially with Windows 10.

Time to upgrade to VS 2010 or above and use the CR Assemblies.

Don

Former Member
0 Kudos

Don Williams


Thanks for your answer.


Yes, I do!


I don't think  that this could be the reason because I'm running into a virtual machine - Windows XP


The only one reason I need to get data from CR is because I must know Total Pages Reported in CR!!!


If I could do this another way...



0 Kudos

I don't recall how to now but try searching the Object Browser for Total page count and see if there is an API to get it directly.

Don

Answers (0)