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!

Access password-protected database.

Status
Not open for further replies.

Flupke

Programmer
Jun 26, 2002
94
BE
Hello everyone,

I still have problems to display reports based on password-protected databases.
The database is Access 2003.
Crystal Reports is version 10 and I use the CrystalActiveXReportViewer (crViewer.dll) to display my reports. I am NOT using the Report Designer.
This CrystalActiveXReportViewer is placed on a form in a Visual Basic 6.0 program.

You pointed me to several example-files, but those examples which were given here all use the Report Designer. So far I wrote the following code to display reports for non-password-protected databases. This code works fine.

Dim crxToepassing As New CRAXDRT.Application

With crViewerDienstrooster
.ReportSource = crxToepassing.OpenReport(gsRapportnaam)
.ViewReport
End With

Set crxToepassing = Nothing

Can someone help me to include code to allow password-protected databases or point me unto information to set the database-password using the CrystalActiveXReportViewer in Crystal Reports 10 and not using the Report Designer.

When I look at the examples using the Report Designer, I do not seem able to integrate them with my existing code.

What am I missing?

Many thanks and greetings from Brugge (Bruges - Belgium),

Michel
 
Without knowing how you're accessing the database (natively, ODBC, OLEDB, etc. ?), I can't give you an exact solution.

In a nutshell, you need to set the login information for the report in order for it to access the database.

Read this document - Report Designer Component 9 - Connection Properties - to get the correct connection info for your db connectivity. You'll end up with something like this (this example is for an ODBC connection):
Code:
   Dim crxToepassing As New CRAXDRT.Application
   Dim crxRpt As CRAXDRT.Report

   Set crxRpt = crxToepassing.OpenReport(gsRapportnaam)
 
   Dim ConnectionInfo As CRAXDRT.ConnectionProperties

   Set ConnectionInfo = crxRpt.Database.Tables(1).ConnectionProperties
   ConnectionInfo.Item("DSN") = "YourDSN"
   ConnectionInfo.Item("Password") = "YourPassword"

   With crViewerDienstrooster
      .ReportSource = crxRpt
      .ViewReport
   End With
-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top