Link to home
Start Free TrialLog in
Avatar of cindafuzzy
cindafuzzy

asked on

open password protected access with databound

hi there,
like to ask you something.
how to open password protected access database with databound object.
Avatar of Voodooman
Voodooman

Hi

this is easy!

With an ordinary data control you need to set the connect property

data1.connect="MS Access;pwd=voodoo"

data1.refresh

A better alternative is to create a workspace - then all data controls are connected through this - no need to set the password everytime - and no need to connect to the database everytime.

'Put this in a Global module under declarations
'***************************************
Global WS As Workspace
Global db As Database

'now use this to create a workspace and open a connection to the database
'**************************************

Set WS = DBEngine.Workspaces(0)
Set db = WS.OpenDatabase(Database, False, False, "MS Access;pwd=voodoo")

'Replace Database with your database and voodoo with your password
'***********************************


Note - in design time you will need to set the connect to see the fields!!

Good Luck

Voodooman!
This is with ADO.

Dim sCon as string
Dim cnAcct as New ADOB.Connection
sCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db2.mdb;Persist Security Info=False;User Id=Admin;Password=Val;"
cnAcct.Open sCon
voodooman's example omits the final ; on the end of the user password as marine's example correctly shows. This will make all the difference in the world.

M
Hi

Ooops!

Thanks

Voodooman!
Voodooman, how could that have happened? You do have an "error correcting" modem don't you? ;-)

M
Avatar of cindafuzzy

ASKER

Adjusted points from 50 to 58
Thanks, the answer given can enable connecting databound contol to the database. Unfortunately, it doesn't solve my problem.

All the solution you guys gave works fine during runtime, but not at design time.

The databound control properties (record source) cannot be opened, given me an error "Not Valid Password", hence I cannot set datafields of objects such as text boxes or picture boxes. I not going to bound all those objects during runtime.
sorry guys,

I just get the answer from microsoft msdn, http://support.microsoft.com/support/kb/articles/Q160/1/69.asp, that answer my question.
sorry guys,

I just get the answer from microsoft msdn, http://support.microsoft.com/support/kb/articles/Q160/1/69.asp, that answer my question.
This question has a deletion request Pending
This question no longer is pending deletion
ASKER CERTIFIED SOLUTION
Avatar of Voodooman
Voodooman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have seen some systems get fussy about the final ;, Oracle for one is very picky.

cindafuzzy, I agree with voodooman, give him the points.

M
Mark turned against me. I certainly hope he is using ADO then i get the points :)
GEE he is not
Comment accepted as answer
Thanks for the points

Bye Bye for Now

Voodooman!