
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