Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal 7 and VF7

Status
Not open for further replies.

Triplex

Programmer
Oct 10, 2002
43
PH
Hi Everyone,

I have read some forum with regards to Crystal Report and Visual Foxpro and can't find solution with my problem.

Before I'm using VF6 I can't use this code below. When we migrate into VF7 the code is already working. I add the crystal report activex control into my form.

THISFORM.Olecontrol1.DataFiles(0) = "C:\s_files\sample.mdb"
THISFORM.Olecontrol1.ReportFileName= "C:\s_files\report2.rpt"
THISFORM.Olecontrol1.WindowTitle = "Sample Report"
THISFORM.Olecontrol1.Action = 1


Now my problem is we also migrated into SQL200 database and I'm having this kind of problem.

THISFORM.Olecontrol1.ReportFileName= "C:\s_files\report2.rpt"
THISFORM.Olecontrol1.WindowTitle = "Sample Report"
THISFORM.Olecontrol1.Action = 1


Program Error:
Ole IDispatch exception code 0 from CrystalReport: Cannot
Open SQL Server...

Thanks
Triplex


 
Triplex,

This isn't really a VFP problem. For some reason, your Crystal report cannot access the database. That might be because of a bad ODBC connection, or a lack of permissions, or you are trying to access the wrong tables or fields, or many other reasons.

Without knowing more about your report, it will be difficult to answer this.

On another point, I would suggest that you abandon the Crystal ActiveX Control, which is no longer supported, and instead use the more reliable Report Design Component (RDC).

Mike


Mike Lewis
Edinburgh, Scotland
 
Hi Mike,

Yah I read about RDC but still I dont know where to start maybe because I've been using Crystal Activex Control. Can you give me an Idea on where to start. and sample code on how to do it.

Thanks
Triplex
 
Triplex,

You might start with faq184-3039. There's also an article on my web site, at:

Also, Craig Bernton, who is the acknowledged expert in this area, is a member of the forum. With luck, he will see this thread and post some more advice.

Mike


Mike Lewis
Edinburgh, Scotland
 
From the title of this thread, it appears you're using Crystal Reports 7. I believe (but could be wrong) that the RDC didn't exist until Crystal Reports 8. I recommend you look at upgrading to the current release of Crystal Reports, which is version 9. Be aware that the ActiveX control you've been using does not exist in CR9.

To get started with the RDC, you can look at the articles on my web site or for detailed information, get my book.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
Craigber,

Actually we already have Crystal ver 9 and start converting Ver 7 into it.

I tried some codes posted in other forum and it works, but there using plain VF database or Access database. How about if I'm using SQL database?

I'm getting an error like this.

Server has not yet been opened.

Triplex

 
Triplex,

This comes back to my earlier reply -- that the problem lies in your connection to the SQL Server database. It might be related to ODBC, or permissions, or the wrong table or field names.

The best way to solve a problem like this is to start with the simplest possible case. Create a report that accesses one field in one table of your SQL Server database. Eliminate as many variables as possible. If it works, add one feature at a time, building up to the required solution. When it stops working, that will tell you where the problem lies.

Mike


Mike Lewis
Edinburgh, Scotland
 

Mike,

I think theres no problem with the report also with the code. The only missing is the syntax on how to open an SQL database programmatilly.

My ODBC name is "HPI_GL"
User Name : "User"
Password : "Password"
---------------------------------------------------------

Thanks
Triplex




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top