Article ID: 163002 - View products that this article applies to.
This article was previously published under Q163002
This article demonstrates how to open and view the contents of a secured Access database using Visual Basic. The steps below outline this process:
This section demonstrates how to create a sample Visual Basic program to open a secured Access database. To use this sample program, you will need a secured database with the following attributes:
To create this secured database, refer to the chapter in the Access documentation listed in the REFERENCES section of this article. Alternatively, you could secure one of the sample applications using the same instructions and make the appropriate changes in the code.
Database Name: Secure AccessDB.mda Database Table: Name Table Field: Last Name User Name: NewAdmin Password: NewAdmin Member of: Admins Group Permissions: All
Steps To Reproduce
Possible ErrorsThe following is a list of possible errors you may encounter when you write a program to open a secured database. The error message is shown first, followed by the code that is highlighted when you click the debug button. The possible cause and then the solution is shown for each line of code:
Error: Run-time error '3028'
Can't start your application. The system database is missing or opened exclusively another user.
Debug: Set My Workspace = DBEngine.CreateWorkspace("New", _ "Admin", _ "")
Cause: You are setting the workspace using the global administrator user name and password. The global administrator may not have the necessary permissions to open the secured database.
Solution: Change the parameters to a valid user and password as specified in the system database.
Debug: DBEngine.IniPath = <path and file name of an initialization file specifying the location of the system database>
Cause: In 32-bit Visual Basic, this property requires the registry entry of the system database.
Solution: Set the property to the system database registry location or use the SystemDB property of the DBEngine object. Set the SystemDB property to the location and file name of the system database.
Error: Run-time error '3029'
Not a valid account name or password
Debug: Set MyWorkspace = DBEngine.CreateWorkspace("New", "UserName", _ "Password")
Cause: User name or password is not in the system database.
Solution: Add the user name and password to the system database. Refer to the chapter in the Access documentation listed in the references section of this article on how to add users to the system database.
Error: Run-time Error '3265'
Item not found in this collection.
Debug: Set db = DBEngine.Workspaces("New").OpenDatabase("SecuredDB")
Cause: New workspace was not appended to the workspace object of the DBEngine object.
Solution: Use the Append method of the DBEngine.Workspaces object to append the new workspace object to the DBEngine object. For more information, see the Append method in the Visual Basic online Help.
Chapter 14 - Securing and Delivering Your Application, Building Applications with Microsoft Access for Windows 95.
Visual Basic Online Help - search on IniPath property, and then select the topic: DBEngine IniPath Now Uses Registry Entry (ReadMe)
For additional information, please see the following article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/161016/EN-US/ ): INF: Using DAO to Open Password-Protected Database (7.0/97)
Article ID: 163002 - Last Review: February 12, 2007 - Revision: 4.2
Contact us for more help