We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

call a crystal reports 4.6 from vb6

Medium Priority
2,867 Views
Last Modified: 2013-11-28
Hi everybody,
I want to print or preview a report made with crystal reports 4.6 by clicking on command button on a vb6 form.  I want to use version 4.6 of crystal report (don't want to update).  I use an access database (called mydb.mdb).
So I creat a crystal report (called myreport.rpt), a crystal report control ( called CrystalReport1) on the vb6 form and a command button with the associated code:

CrystalReport1.ReportFileName = Dir1.Path & "\myreport.rpt"
CrystalReport1.DataFiles(0) = Dir1.Path & "\mydb.mdb"
CrystalReport1.DiscardSavedData = True
CrystalReport1.action = 0

I get error 20536 : "Unable to connect: incorrect log on parameters"

I tried to use these additional commands:
id = CrystalReport1.LogOnServer("p2sodbc.dll", "access", "mydb", "Admin", "")
or
CrystalReport1.Connect = "dsn=odbc;uid=admin;pwd=;dsq=mydb.mdb"
or
CrystalReport1.LogonInfo(0)= "dsn=access;uid=admin;pwd=;dsq=mydb.mdb"

But none of these solve the problem. And I am not shure that the arguments I wrote are good.

I know this question is already asked on this website, but everytime, the solution is a link like http://support.businessobjects.com/library/kbase/articles/c???????.asp and when I try to follow this link, I am redirected on another website : https://websmp205.sap-ag.de/~SAPIDP/002006825000000234912001E

Thanks in advance for your help.
Comment
Watch Question

Commented:
I bought (for $16) Ken Hamady's guide to Crystal reports in VB6.  It showed me exactly what to do to get VB communicating with Crystal.

http://www.kenhamady.com/vbref.html

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:

Author

Commented:
Thanks for your answers.
mlmcc, I tried the sample code in splitrpt.zip but i can't execute  the "report1.rpt" file with crystal report (error message: unable to load report). So I ceated another report based on the cost.mdb database with one field (totals.total). And when I launched the vb programm, I got the error 20536 unable to connect : incorrect logon parameters...

spangdelta, does Ken hamady's guide answered your questions about version 4.6 of crystal reports?

Thanks for your help
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.