devxlogo

Creating Database Passwords in VB4

Creating Database Passwords in VB4

Jet 3.0 (32-bit VB4 only) includes a new security system basedon database passwords that you may use instead of the more complex,more secure, workgroup security system. This system allows youto set a single, all-user password to open a database. While muchsimpler to implement and use, this system is very easily compromisedbecause all users use the same password. In addition, it doesn’tlet you track individual user activity in a shared database. However,you can use both workgroup-based security and database passwordsat the same time.

Set a database password in VB using the NewPassword method ofthe database object, using code like this:

 Dim wrk As WorkspaceDim dbPwd As DatabaseSet wrk = DBEngine.Workspaces(0)' You must open the database ' exclusively (note 2nd parameter).Set dbPwd = _wrk.OpenDatabase_        ("MyData.MDB", True)' Set the database password which ' currently is blank to "NewPass".dbPwd.NewPassword "","NewPass"
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist