Link to home
Start Free TrialLog in
Avatar of dayiku
dayiku

asked on

Open Crystal reports file with Visual Basic application

Hi,
   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
    CRViewer1.ViewReport

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

Can anybody help me to get this to work?
Avatar of ptan218
ptan218

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.
Avatar of dayiku

ASKER

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.
Check out the windows\crystal folder to see if the above dlls are there/
Avatar of dayiku

ASKER

I found the dll in the system folder. Should i put it in the crystal folder?
ASKER CERTIFIED SOLUTION
Avatar of ptan218
ptan218

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dayiku

ASKER

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"