p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Pro VB Databases (http://p2p.wrox.com/forumdisplay.php?f=81)
-   -   Crystal Report 9 password protected mdb ACCESS (http://p2p.wrox.com/showthread.php?t=58504)

sajid_rauf May 29th, 2007 10:59 AM

Crystal Report 9 password protected mdb ACCESS
 
Hi,

I can access my protected mdb in the CR designer in VB6 via giving it the password when I make the connection via wizard but when I run the software it forgets the password and does not connect to the DB at run time. I am using Crystal Report 9

How can I supply the password in my code?

Code:

dim Report as new myrep 'myrep is the report in the designer

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
CRViewer91.ReportSource = Report
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
End Sub

Hoping to receive an early reply.

Take care, Peace!


alweisenborn July 26th, 2007 07:44 PM

Try this:
Sub PrintReport()

    Dim Password as String
    Dim crxReport As CRAXDRT.Report
    Dim crxTable As CRAXDRT.DatabaseTable
    Dim mcrxApplication As New CRAXDRT.Application

    Screen.MousePointer = vbHourglass
    Set CRXReport = crxApplication.OpenReport( _
        App.Path & "\MyReport.rpt", 1)
    Password = "MyPassword"
    CRViewer91.ReportSource = crxReport

        For Each crxTable In crxReport.Database.Tables
            crxTable.SetSessionInfo "", Chr(10) & Password
        Next crxTable

    CRViewer91.ViewReport
    Screen.MousePointer.vbNormal

End Sub



Best Regards,

Al Weisenborn

sajid_rauf July 27th, 2007 02:29 AM

Hello Bro,

Unfortunately this is not working and I get "Could not find installable ISAM" error message. When I hit the refresh button on the top it says "Not a valid password"

I know that the password is correct since the VB front-end using the password protected mdb is working fine; it's the Crystal Report that does not retrieve the data from the password protected mdb.

Note (just in case if there is a confusion): I am using a password protected mdb not a password protected Crystal report (the report object is in the VB designer and accessing via ADODB MS JET 4 engine).

Take care, Peace!



All times are GMT -4. The time now is 08:35 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.