Solved

Problem printing Crystal Report from VB - Run Time Error 20599

Posted on 2003-11-17
7
2,193 Views
Last Modified: 2007-12-19
I am using Visual Basic 6.0 to connect to a Crystal Report through the Crystal Report control crystl32.oxc.  The report was generated in the 32-bit Crystal Report Designer in Crystal Reports 6.0 and connects to an Access 2000 database.  

The Crystal Report Control is setup to connect to the report (ReportFileName = "C:\Database\matdata.rpt") and to print to the window (Destination = 0).  All other parameters are set to default.

A command button is used with the single command:
CrystalReport1.Action=1

This originally worked, but the database was not being updated.  I read that I needed to change the "Save data with report" option to be unchecked in order for the data to be updated.  I unchecked this option and saved the report.

Now when I run the program and call the above print command, I get the following error:

Run-time error '20599':
Cannot find SQL server.

I'm not sure if this is a problem with the way that I am creating the report or with how it is being called from VB.

Please advise.
0
Comment
Question by:pjpruitt
[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 13

Expert Comment

by:EwaldL
ID: 9766449
are you getting this on your development machine with the full cr 9 install? if so, then open the report in the cr designer, hit "database" -> "verify database". Now refresh the report and save the .rpt without saved data. Can you now view the report through your application? Should this fail, is there a password on the access database?
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9766620
You're getting a SQL server connection when connecting to Access 2000?  Assuming your db connection isn't completely hosed, I suspect that you have an instance of Access which has linked / imported tables from SQL Server?  

If that's correct, the problem is more likely that your connection from Access to SQL server has broken - probably not a problem with the C.R.  Open Access and fix your link and that should solve the problem...
0
 

Author Comment

by:pjpruitt
ID: 9767198
I can verify the database, and there is no password associated.  I still get the same error.

The db connection is fine.  I am connecting to the same database through vb to fill in info on forms.  All of my tables in Access are local within the same database.  Nothing is linked/imported.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 42

Accepted Solution

by:
frodoman earned 50 total points
ID: 9767250
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9767258
This one also:

http://support.crystaldecisions.com/library/kbase/articles/c2006655.asp


Both links are talking about CR 7 & 8, but possibly the same problem exists in your version as well.
0
 
LVL 13

Expert Comment

by:EwaldL
ID: 9767394
try creating a new report, adding one single table though the option "Database Files" in the data explorer. Then place only one single integer field on the report. can you view this report now with the option "save data with report" unchecked. Should this still fail then hit "Database" -> "Convert Database Driver". This will list a "pdb*" dll. This file should NOT exist on your machine. Instead replace the second character (the "d") with a 2 and search for this file. If you are finding duplicates, then rename the older versions of that file.
0
 
LVL 1

Expert Comment

by:Krelek200
ID: 9767977
Did you declare your database in your Visual Basic program?  It could be that it is trying to look up nothing, and that is causing the error.
Here is a bit of code for you:

For i = 1 To report.Database.Tables.Count
        report.Database.Tables(i).SetLogOnInfo DSNname, Server, UserID, password
Next i

Specify a datasource using the Datasource Administrator and this should help you stop the SQL Error.

Krelek
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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