Monday, March 12, 2012

Open an Password Protected Access-2000 Database (OLE DB)

I have created reports for a password protected database using Crystal Reports-8 thru OLE DB Connection. Whenever calling the report from a VB Form(thru Crystal Report Active-x Control), it reports "Unable to logon to SQL Server".

But if I try same thru ODBC Connection thru a DSN, it works perfect.

Since, there is a need to change the name of the source database (during runtime, the report has to access data from different databases), I require the same thru an OLE DB Connection. OR there is any way to change the database name in an odbc dsn by modifying connection parameters?

I remain.

Thanks.If u r tring to open Access database which has password. to change the database at runtime u can use the following code in vb.My report using Direct Database file connection not oledb or others.

Report.Database.Tables.Item(1).Location = App.Path & "\" & dbName
Report.Database.Tables(1).SetSessionInfo "", Chr(10) & txtPass

if u have more then on table u can use loop.

No comments:

Post a Comment