Link to home
Create AccountLog in
Avatar of jruhe
jruheFlag for United States of America

asked on

Crystal XI Data Location

Hello Experts,

Environment:
Crystal v. 11.5
VFP 8
Server 2003

I've got the following code which is working well in VFP (for those of you who followed my previous question, that issue is still not resolved--this is a different environment).

crxApplication = createobject("CrystalRuntime.Application")
crxReport = CREATEOBJECT("CrystalRuntime.Report")
txtReport =[j:\development\pro73\MyReport.rpt]
crxReport = crxApplication.OpenReport(txtReport,1)
do form cryst_adhoc
cryst_adhoc.addobject('crviewer1','olecontrol','CrystalReports115.ActiveXReportViewer.1')
crReport.Database.Tables.Item(1).Location="c:\temp\temp123.dbf"

Then the code goes on to attempt to display the report in the crViewer1 control.  I am finding that the last command, above, is not working (changing the location to a temporary table from  the default table.  So, let's say that the table used in the report is "MyTable.dbf"  Even after the last command, above, is run, it will still show that the item(1).location is MyTable.dbf instead of the temp table.  

The old code I had in version 8.5 does show that the table name is changed with  this command.

Any ideas?

Thanks,
jr
Avatar of Mike McCracken
Mike McCracken

How are you looking at the location?

I assume the crRepoert.  should be crxReport.

mlmcc
Avatar of jruhe

ASKER

Yes crxReport

This is how I look at the location in vfp:
? crxReport.Database.Tables.Item(1).Location

jr
Where do you do that?  Is it in a debug mode?

mlmcc
Avatar of jruhe

ASKER

Yes--VFP has a command window (think of it as a constant debug window) that you can type the commands into directly.  When I got an error in the program ("Failed to load database information") I dug around and found that it is not actually changing the table that the report uses to the temporary table, although the command is there and worked in 8.5.

Thanks,
jr
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of jruhe

ASKER

Thanks very much.  The link you provided forced me to explore data sources in general.  It turns out that when XI gets installed as an upgrade, the first time an XBASE report is used, it needs to install the driver for it (p2ixbse.dll, I believe).  So I ran one of the RPT's with a DBF data source manually with Crystal.  It updated the driver, and then this code worked:

crxApplication = createobject("CrystalRuntime.Application")
crxReport = CREATEOBJECT("CrystalRuntime.Report")
txtReport =[j:\development\pro73\MyReport.rpt]
crxReport = crxApplication.OpenReport(txtReport,1)
do form cryst_adhoc
cryst_adhoc.addobject('crviewer1','olecontrol','CrystalReports115.ActiveXReportViewer.1')
crxReport.Database.Tables.Item(1).Location="c:\temp\temp123.dbf"

jr
Interesting.  Since I don't use XBASE I wouldn't have known that.  I haven't seen that with any other database.  I also have always done a new install rather than an upgrade.

Glad you found that.

mlmcc