Another way to implement password management in Access

Source: Internet
Author: User
Tags goto implement access database
As we all know, the security of the database is very important, it directly affects the wide application of the database. Users can use either method to secure a database application or combine several methods. It's easy to take advantage of the encryption and other protections provided by the Access database itself, and I won't say much more. In Access database, embedded a strong database operation language--visualbasic language, so you can use VisualBasic programming, to achieve some complex functions. The following describes how to implement encryption in a VisualBasic program to ensure data security.
----For some companies, the payroll management of employees is a modest problem. Sometimes, leaders need to know how each employee's income will be paid over a period of time in order to master the bonuses. To do this, I have designed a "payroll management" database that can be queried by time and based on the selected wage category. To prevent others from viewing this database, I set a password for the database in exclusive mode. This approach also has some limitations, if the user happens to provide the correct database password, the method can not control the user to operate the database.

----to further prevent staff from looking at the statistics of wages (that is, some bonuses are not public, other than the leader should not know the number of wages, I created a password table, set the password, remember and hide it (first select the password table, and then click the Window menu, "Hide" command, You can hide this form. Then, in the Worker Pay dialog form, add the Password text box and add the following statement to the preview and Print event procedures:

DoCmd.ApplyFilter, "password = forms!
Employee Pay dialog Box! Passtext "
If not IsNull ([password]) Then
* * Other code * *
Else
MsgBox "Please enter the correct password!" "
Passtext.setfocus
End If
* * Other code * *

----This way, the dual encryption function is realized. Even if the user can access the database, if the second time does not provide the correct password, he will not be able to preview and print a certain time range of statistical results. This further limits the user's unauthorized access.
----to improve the security of your database, you should change your password every once in a while. To do this, in the Worker Pay dialog form, I added a "Change password" subform, where you can change your password at any time by adding the following code to the form:

Private Sub OK _click ()
On Error GoTo err_ OK _click
DoCmd.ApplyFilter, "password
= forms! Change Password! Text1 "
If IsNull ([password]) Then
MsgBox ("The password is incorrect,
Please enter again ")
Text1.setfocus
GoTo Exit_ determine _click:
End If
If Text3.value < > Text2.value Then
Text3.setfocus
MsgBox ("Please enter the correct confirmation password")
Else:
Password = Text3.value
DoCmd.Close
End If
Exit_ Determine _click:
Exit Sub
Err_ Determine _click:
MsgBox Err.Description
Resume Exit_ determine _click
End Sub

After you change your password----, you should remember this password for later use.
----Design your program and hide the code in the same way that you hide the table, in case someone else modifies or peeks. The method described here is only a small technique for implementing encryption in a program, and it can be encrypted in other database management. There may be a more concise approach that needs to be explored and communicated with each other in the programming process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.