Logon Failed when running reports with VB6 and CRXI ActiveX Report Viewer in Windows 7


Environment: VB6 SP6, Crystal Reports XI, MS SQL Server 2008 R2, Windows 7

I did not have any problem generating reports with CRXI ActiveX Report Viewer using VB6 in Windows XP or Vista. However, I had to use different syntax in XP and Vista to specify the connection properties for each table referenced in the report.

In XP:

For intCount = 1 To crxReport.Database.Tables.Count
        crxReport.Database.Tables(intCount).ConnectBufferString = adoConn.ConnectionString

Open in new window

In Vista:
For Each crxTable In crxReport.Database.Tables
        crxTable.ConnectionProperties("User ID") = strUid
        crxTable.ConnectionProperties("Password") = strPwd

Open in new window

These 2 methods won't work for Windows 7. Any ideas?


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Alpesh PatelAssistant ConsultantCommented:
Crystal report is not version specific. please have another problem.
JszeLimAuthor Commented:
Hi PatelAlpesh,

Sorry but I don't understand what you're trying to convey.
Ali HNDCommented:
Try this code:
Dim crAPP As New CRAXDRT.Application
Dim Report As CRAXDRT.Report
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions

Dim crDBTab As CRAXDRT.DatabaseTable
Set Report = crAPP.OpenReport("report1.rpt")

Report.Database.LogOnServer "p2ssql.dll", "server", DBReport, "sa", "password"
For Each crDBTab In Report.Database.Tables
crDBTab.SetLogOnInfo "server", DBReport, "sa", "password"
' Disable Parameter Prompting for the end user
Report.EnableParameterPrompting = False
' Gather the list of available parameters from the report
Set crParamDefs = Report.ParameterFields
Report.SQLQueryString = "SELECT * FROM table"
CRViewer91.ReportSource = Report
Set Report = Nothing
Set crAPP = Nothing

Open in new window

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
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
Crystal Reports

From novice to tech pro — start learning today.