Open Crystal reports file with Visual Basic application

Posted on 2006-03-24
Medium Priority
Last Modified: 2013-11-25
   I have created a crystal reports file for my users. I want them to be able to click on an executable and be able to open up the file withou worrying about the login or the server name.
I setup a dsn on their pc so everything should be transparent.
This the code i have now

    Set Report = Appl.OpenReport("c:\crystal_file.rpt")
    Report.Database.LogOnServer "p2sodbc.dll", "DatabaseName", "DatabaseName", "username", "password"
    CRViewer1.ReportSource = Report

I get a "Server has not yet been opened" error message from crystal reports.

Can anybody help me to get this to work?
Question by:dayiku
  • 3
  • 3

Expert Comment

ID: 16285852
I used to have the same problem.

Check out the client PC and ensure that you have the p2sodbc.dll. Or ensure that you have the crystal runtime on the client PC.

Author Comment

ID: 16286110
I tried it on my pc and it doesn't work. Do you know why?
I need to get it to work on my pc before i give it to the client.

Expert Comment

ID: 16286402
Check out the windows\crystal folder to see if the above dlls are there/
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

ID: 16286451
I found the dll in the system folder. Should i put it in the crystal folder?

Accepted Solution

ptan218 earned 2000 total points
ID: 16286626
No. I did not do that. BTW, check out the crystaldecision website, I got my solution from there.

Author Comment

ID: 16286727
This is what i found on the crystal decision website.
Crystal 8 has a know problem with visual basic.

To work around this issue, use the 'SetLogonInfo' method off the 'Tables' object rather than the 'LogonServer' method. For example:

'Sample Code for SetLogonInfo
Report.Database.Tables(1).SetLogOnInfo "server", "database", "UID", "PWD"

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

864 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