Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 and Access with PASSWORD doesn't work for me.

Status
Not open for further replies.

CAPABEND

MIS
Aug 1, 2001
2
US
Have a simple program which works fine working with an Access DB. Thought it would be a simple matter to Password protect the DB. Can't get it to go. First I tried the old VB3.0 statement SetDefaultWorkspace "Admin" , "MyPW".
Thought this would be compatible w/VB6. It resulted in a compile error: "Function or interface marked as restricted...etc". Being new to VB6, then thought maybe I had to use the OpenDataBase function. Got the impression the DataBaseName property had to be set first. So tried various forms of:

Dim d as DataBase
Set d = OpenDataBase(localpath,True,false," ;PWD=MyPW")

This resulted in VB message "Not a Valid Password". It appears that a Password check is done when I place the DataBaseName property in the DAO control. So moved the OpenDataBase function prior to setting the property and now I get run-time error on the OpenDatabase function which
says "Couldn't Find Installable Isam - error 3170".

None of this makes any sense to me. First why can't I use the simple old SetDefaultWorkspace statement? Secondly, if not, then how are you suppose to pass a password to Access if not by the above mentioned mechanism?

Does anyone understand all of this? This novice is at a loss. Thanks in advance for any clarification of this.
 
Updating my own question. Discovered the old SetDefault Workspace statement is now defunct. So attemped use of the following as the replacement mechanism.

DBEngine.SystemDB= "system.mdw" (gave full path)
DBEngine.DefaultUser = "Admin"
DBEngine.DefaultPassword = "MyPW"

This effort resulted in "Not a Valid Account Name or Password" (3029).

My assumptions all along is that there is a default user called "Admin" (Admins Group) with a default password of null established by Access. I assumed all I had to do was set my password for use with the default Workspace and default User. Is that not the case?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top