Thursday, March 8, 2012

Crystal Report 9 and Password Protected Database

Any body who can help me to connect Password Protected MS Access Database from Active X Crystal Report Engine:

I tried as under:

Dim CRApp As New CRAXDRT.Application
Dim CRRpt As New CRAXDRT.Report

Set CRRpt = CRApp.OpenReport(App.Path & "\Reports\" & ReportFileName & ".rpt")
CRRpt.DiscardSavedData
CRViewer.ViewReport

But It causes an error described as under:
----------------
LogOn Failed.
Detials: ADO Error Code 0x80040e4d
Source: Microsoft Jet Database Engine
Description: Not a Valid Password
SQL State: 3031
Native Error: -124782449
----------------

How can I get rid off this error by supplying login info or password?Thnak for all the visitor to my question!
I have solved the problem.

Dim CRApp As New CRAXDRT.Application
Dim CRRpt As New CRAXDRT.Report

Set CRRpt = CRApp.OpenReport(App.Path & "\Reports\Products.rpt")
CRRpt.DiscardSavedData

CRRpt.Database.Tables(1).ConnectionProperties("Jet OLEDB:Database Password") = "My_Password"

CRViewer.ViewReport

No comments:

Post a Comment