I am want to open a password protected MS Access database with DAO from my program. But I want to open the databse with the password entered in a text box. I am using the following statement :

Set DB = OpenDatabase(App.Path & "\Data.mdb", False, False, ";pwd=Text1.Text")

But this does not work out and the "Invalid Password" error is displayed.

Can someone tell me how to open a database by entering its password in the textbox and sending the textbox value to the database?

Please help me out.

Thanks in advance.
Kinjal