Crystal Report 9 and Password Protected Access Database

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

Set CRRpt = CRApp.OpenReport(App.Path & "ReportsProducts.rpt)
CRViewer.ReportSource = CRRpt
CRViewer.ViewReport

I am using Password Protected Access Database, Report show only those records which were recorded before report designing. On Execution the code given above ,there is no error. While Refreshing report pressing refresh button from
Report Viewer causes an error dexcribed as under:

Logno Failed.
Details: ADO Error Code: 0x80040e4d
Source:Microsoft JET database Engine
Description: Not a Valid Password
SQL State: 3031
Native Error: -124782449

Comments

  • It sounds like during the refresh it is trying to open another session of the access database. if your file access privilages or connection string only allows a single session open at a time then that would explain your error message.

    either modify your code so you don't reintialize your objects,
    or set all your objects to nothing after the report is created,
    or check your connection string and make sure your not opening the database exclusively,
    or check your default file priveliges.

    : Dim CRApp As New CRAXDRT.Application
    : Dim CRRpt As New CRAXDRT.Report
    : Dim CRTbl As CRAXDRT.DatabaseTable
    :
    : Set CRRpt = CRApp.OpenReport(App.Path & "ReportsProducts.rpt)
    : CRViewer.ReportSource = CRRpt
    : CRViewer.ViewReport
    :
    : I am using Password Protected Access Database, Report show only those records which were recorded before report designing. On Execution the code given above ,there is no error. While Refreshing report pressing refresh button from
    : Report Viewer causes an error dexcribed as under:
    :
    : Logno Failed.
    : Details: ADO Error Code: 0x80040e4d
    : Source:Microsoft JET database Engine
    : Description: Not a Valid Password
    : SQL State: 3031
    : Native Error: -124782449
    :

  • Thank you very much.

    I have solved the problem by adding only a single code line.

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

    Set CRRpt = CRApp.OpenReport(App.Path & "ReportsProducts.rpt)
    CRViewer.ReportSource = CRRpt
    [red]CRRpt.Database.Tables(1).ConnectionProperties("Jet OLEDB:Database Password") = "my_password"[/red]
    CRViewer.ViewReport

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories