Solved

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

Posted on 2001-07-17
7
309 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

920 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

13 Experts available now in Live!

Get 1:1 Help Now