• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1450
  • Last Modified:

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

Hi,

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
Next

Open in new window


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

Open in new window


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

Thanks.

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

Sorry but I don't understand what you're trying to convey.
0
 
Ali HNDCommented:
Hi
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"
Next
' 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
CRViewer91.Refresh
CRViewer91.ViewReport
Set Report = Nothing
Set crAPP = Nothing

Open in new window

0
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.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now