Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2001-07-17
7
Medium Priority
?
328 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 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