Solved

Simple, How to call an ODBC Crystal Reports Report From VB 6.0

Posted on 2001-07-17
7
308 Views
Last Modified: 2012-06-27
This has got to be simple:

I'm writting an ap that will call a Crytal Reports .RPT file and run the report.

The report is for an ODBC database. (Progress)

Everytime I run the report I get an error message that says:

"Cannot open SQL server. Error 20599"

I've entered in the report name, user name and password into the properties of the Crystall OCX. And I know the report works.

Thank you in advance for your help.
0
Comment
Question by:povern
7 Comments
 
LVL 1

Expert Comment

by:Sieger
ID: 6290027
Is your App using the same ODBC DSN as the report?  sometimes it gives you that error because the DSN names are diff.  
0
 
LVL 2

Accepted Solution

by:
chandukb earned 100 total points
ID: 6290235
Here is my code and it is working:

With cryReport
'    .Connect = "DSN=" & gstrDSN & ";UID= " & gUser & ";PWD= " & gPassword & ";DSQ="
     .ReportFileName = ".rpt file"
    .DiscardSavedData = 1
    .DataFiles(0) = sDataFile
    .SelectionFormula = sCriteria
    .WindowTitle = rsReport!REPORTNAME
    .Action = 1
End With


Chandu

0
 
LVL 2

Expert Comment

by:chandukb
ID: 6290248
Another method, also works:

in your form load:

dim cnRptId as integer

cnRptId = cryReport.LogOnServer("p2sora7.dll", gstrDSN, "", gUser, gPassword)

'Display report, cryReport is the ocx
With cryReport
   .ReportFileName = ".rpt file"
   .DiscardSavedData = 1
   .DataFiles(0) = sDataFile
   .SelectionFormula = sCriteria
   .WindowTitle = rsReport!REPORTNAME
   .Action = 1
End With

In your form unload:

cryReport.LogOffServer cnRptId, False

If u still having problems, please post your crystal version.

Chandu





0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:povern
ID: 6290834
Thanx All
0
 
LVL 2

Expert Comment

by:chandukb
ID: 6293868
Hi Povern,

If my comments satisfy your needs, please accept my comments as Answer, or post your questions, if any.

thanks
Chandu
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7153498
Hi povern,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept chandukb's comment(s) as an answer.

povern, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7182131
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now