Using the CR 4.6 that comes with VB 5 
Author Message
 Using the CR 4.6 that comes with VB 5

Hello,

If nothing else this question may be good for a laugh, version wise.

Our app uses Access 97 / VB 6.  I need to print some real simple reports.
For starters I thought I'd try using the CR 4.6 that comes with VB 5, but
not having much luck.  Not good luck anyway.

If I set CR control datasource to datacontrol, and then populate the
datacontrol with a sql query at runtime, the report shows the expected
records.  But it seems the report file (myreport.rpt) that is created in CR
Designer is ignored - for example, no report title is present, just the data
records.

If instead I set CR datasource to crreport, things get worse.  I get a
"can't connect" error in the CR.lasterror property.  No report at all.

Soooo ... my question - can I define a CR report file, and then define the
recordset (both the database and the recordset) at runtime ?

appreciate any help...  thanks



Mon, 25 Jul 2005 04:19:28 GMT  
 Using the CR 4.6 that comes with VB 5
Hello Stewart

If I have understand you right than it's not a problem

At first you have to create a report

At desingtime:
In the property window
Set the Data1.databasename to your database
Set the Data1.Recordsource to a query in your database or write in a SQL
Statement in the line. like "Select * from Table1"

Set the CrystalReport1.Datasource to Data1
Set the CrystalReport1.ReportSource to 3 = Datacontrol
Then click the 'userdefind' button

Go to the databound report tab and click the button 'save as' and save your
report like c:\Test_1.rpt

Now the report is saved with all the fields from your Recordset and you can
format the report with Crystal Reports later

Set the CrystalReport1.ReportSource back to 0 = Report

And if you want Set the Data1.databasename to blank and the
Data1.Recordsource to blank
You can connect this at runtime to your database!

Then

At runtime
Connect the data1 with your database and set the Data1.Recordsource to the
same SQL Statement with which you have created the report.

Data1.Recordsource= "Select * from Table1"

Data1.Refresh
CrystalReport1.ReportSource = crptReport
CrystalReport1.ReportFileName = "c:\Test_1.rpt"
CrystalReport1.Action = 1

Hope this helps

Hans



Quote:
> Hello,

> If nothing else this question may be good for a laugh, version wise.

> Our app uses Access 97 / VB 6.  I need to print some real simple reports.
> For starters I thought I'd try using the CR 4.6 that comes with VB 5, but
> not having much luck.  Not good luck anyway.

> If I set CR control datasource to datacontrol, and then populate the
> datacontrol with a sql query at runtime, the report shows the expected
> records.  But it seems the report file (myreport.rpt) that is created in
CR
> Designer is ignored - for example, no report title is present, just the
data
> records.

> If instead I set CR datasource to crreport, things get worse.  I get a
> "can't connect" error in the CR.lasterror property.  No report at all.

> Soooo ... my question - can I define a CR report file, and then define the
> recordset (both the database and the recordset) at runtime ?

> appreciate any help...  thanks



Wed, 27 Jul 2005 20:56:28 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Access 7.0 Date/Time Fields not accessible using CR 4.6

2. VB 6.0, Access 97, CR 4.6

3. VB 6.0, Access 97, CR 4.6

4. VB & CR 4.6 Stored Procedure Parameters

5. CR8 upgrade to VB 6 CR 4.6 ?

6. Does CR 4.6 actually work with VB 6 ?

7. Problem in Selection formula, CR 4.6, VB 6.0

8. PROBLEM WITH VB 6 AND CR 4.6

9. VB 6.0, Access 97, CR 4.6

10. Bound Report w/ CR 4.6 and VB 5.0

11. GPF with VB 5.0 and CR 4.6

12. CR 4.6 and VB 6.0

 

 
Powered by phpBB® Forum Software