Open Crystal reports file with Visual Basic application

   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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
dayikuAuthor Commented:
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/
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

dayikuAuthor Commented:
I found the dll in the system folder. Should i put it in the crystal folder?
No. I did not do that. BTW, check out the crystaldecision website, I got my solution from there.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dayikuAuthor Commented:
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"
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.