Solved

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

Posted on 2001-07-17
7
310 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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

809 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