Click to See Complete Forum and Search --> : VB6 & CR10 dynamic query setup problem


themaj
July 6th, 2006, 01:17 AM
I have created several reports that launch from VB6 with a simple command but do not rely on any dynamic input.
Now I need to add a date range query and although I think I got the query right, I'm really not sure what prep code I need to get it to work.
I guess I have to create an object and other 'things'. Besides Crystal ActiveX Report Viewer, are there any other components or dependencies required?
Am I getting close with this? It certainly isn't working right now.

Private Sub cmd_test_Click()
Set crxApp = New CRAXDRT.Application
Set crxRpt = crxApp.OpenReport(App.Path & "\Deliveries by Product Abbrev.rpt")

crxRpt.RecordSelectionFormula = "{transactions.TRANS_DATE} >= 20060600 and {transactions.TRANS_DATE} < 20060615"

crxApp.ReportSource = crxRpt
crxApp.ViewReport

End Sub

**Assume that the {transactions.TRANS_DATE} is being stored in the DB as a long integer so a 'date' of 20060600 would not be a valid date but it is a good marker as the beginning of June'06.

Obviously I'm new at this and any help to get this simple thing working would be greatly appreciated.

wapper
July 14th, 2006, 02:39 AM
The problems that I can see are:
- what is crxApp? is it CRAXDRT.Application or CR OCX viewer?
- you are not doing SetLogOnInfo on your tables, that means report will not work if moved to another server or database.

The SelectionFormula seems to be fine and should work ok.
For a list of dependencies, please see Runtime.hlp file in your Crystal directory, or on the CDROM. Basically there are two files, CRAXDRT.DLL and CRVIEWER.DLL, that are needed to display a report. But you also need to have corresponding database access DLL, and (optionally) other DLL-s for exporting data.

themaj
July 15th, 2006, 05:26 AM
wapper,
I think my first problem is that I need the 'Developer' version of CR10 as opposed to the Professsional version to accomplish my task. Would you know that to be true?

I want to use VB6 to pass arguments to CR10.