Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting Crystal Reports to an Access database

Status
Not open for further replies.

rushdib

Programmer
Jun 12, 2001
203
US
Hi,
I am trying to connect a Crystal Report to an Access 2000 database. This database opens with a password. I am using ADO to connect, and entered the system data base and password. But when I open the report, I get a log on screen. This never happens, if the database does not contain a password. How do I automate the log in information?

Thanks in advance,

Rushdi
 
I assume that you’ve already created the Report and dragged and dropped CrystalReportViewer and ReportDocument components on your Form.

In terms of CrystalReportViewer, If you have multiple-table data source for your report, think each table has its own db authentication. So you need to loop through all the tables involve in your report.

Here is the code:

Imports CrystalDecisions.Shared

Dim rptName = new yourReport()
Dim conn = new ConnectionInfo()
Dim infos = new TableLogOnInfos()
Dim info = new TableLogOnInfo()

Conn.ServerName = “yourServerName” ‘ or Data Source Name
Conn.DatabaseName = “yourDatabaseName”
Conn.UserID = “yourUserID”
Conn.Password = “yourPassword”

info.Connnection = conn
info.TableName =”yourTableName”
infos.Add(info)
CrystalReportViewer1.LogOnInfo = infos
CrystalReportViewer1.ReportSource = rptName
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top