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)
-   -   Passwrd protected mdb file from Crystl Rpt in vb6 (http://p2p.wrox.com/showthread.php?t=33885)

Kaustav September 30th, 2005 11:22 PM

Passwrd protected mdb file from Crystl Rpt in vb6
Plz help. Its urgent. When i m trying to connect an access database using crystal report viewer in vb6 I am getting an error saying "not a valid password". I have tried OLEDB, Access(dao) connections from crystalreport1 designer control. But in vain.

PLz give me a through detail about how can i solve this problem.
Note: my database report can be opened directly by crystal report directly without going through vb6.



alweisenborn October 24th, 2005 08:08 PM

You need to prepend a linefeed character to the password for it to work, see the example below:

Dim mCRXReport As CRAXDRT.Report
Dim crxTable As CRAXDRT.DatabaseTable

Set mCRXReport = mcrxApplication.OpenReport _
                    ("MyFolder\MyReport.rpt", 1)

    For Each crxTable In mCRXReport.Database.Tables
        'The next line just supplies the database location
        crxTable.SetTableLocation "c:\MyStuff\MyData.mdb", "", ""
        'Add a linefeed to your password
        crxTable.SetSessionInfo "", Chr(10) & "MyPassword"
    Next crxTable

Best Regards,

Al Weisenborn

All times are GMT -4. The time now is 09:59 AM.

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