?
Solved

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

Posted on 2001-07-17
7
Medium Priority
?
325 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 400 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 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