Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Creating Database Passwords in VB4

Jet 3.0 (32-bit VB4 only) includes a new security system based on database passwords that you may use instead of the more complex, more secure, workgroup security system. This system allows you to set a single, all-user password to open a database. While much simpler to implement and use, this system is very easily compromised because all users use the same password. In addition, it doesn't let you track individual user activity in a shared database. However, you can use both workgroup-based security and database passwords at the same time.

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

Dim wrk As Workspace
Dim dbPwd As Database

Set wrk = DBEngine.Workspaces(0)

' You must open the database 
' exclusively (note 2nd parameter).
Set dbPwd = _
        ("MyData.MDB", True)

' Set the database password which 
' currently is blank to "NewPass".
dbPwd.NewPassword "","NewPass"

Paul Litwin
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date