Microsoft Access用户密码限制 [英] Microsoft Access user password restrictions

查看:314
本文介绍了Microsoft Access用户密码限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想限制我的Access数据库要使用的某些人,并给予这些人视他们是谁一定的限制。我看到有关创建与用户和密码的表,并使用一些VBA code进行验证一对夫妇的文章(或东西的那种,我是pretty的VBA文盲)。有谁知道在哪里可以找到一步一步本文就如何做到这一点?

I'm trying to restrict my Access database to be used by certain people and to give those people certain restrictions depending on who they are. I'm seeing a couple articles about creating a table with users and passwords and using some VBA code for validation (or something of the sort, I'm pretty VBA-illiterate). Does anyone know where I can find a step-by-step article on how to do this?

另外,也许使它更简单,我有链接到其他形式的一种形式。这些链接会读数据录入,经理人等,以及链接可能是密码保护。也就是说,当经理单击Manager链接,他输入密码,然后带到那里,他可以编辑任何及所有信息的表格。然而,当数据输入点击,他们进入一个不同的密码,然后被带到一个表单中只显示的字段,使他们能够编辑。

Alternatively, maybe making it simpler where I have a form with links to other forms. The links would read "Data Entry", "Manager", etc. and the links could be password protected. I.e., when the Manager clicks the Manager link, he has to input a password and is then taken to a form where he can edit any and all information. Whereas, when Data Entry clicks, they enter a different password and are then taken to a form where they are only displayed fields in which they can edit.

感谢您先进的。

推荐答案

安全性是在MS Access的关键击点。如果你想实现登录功能,我认为你的商业模式包含莫名其妙的敏感信息。这样的经营模式通常期望/需要多条均线的软件设计技能。

Security is a critical hitting point in MS Access. If you want to implement login function, I assume your business model contains somehow sensitive information. Such business model usually expects/requires more than average software designing skills.

首先,您需要定义/设计您的业务需求,从

At first you need to define/design your business requirements starting from

  • 如果MS Access是什么让你开始。
  • 然后使用什么版本的MS Access
  • 在单用户,多用户,本地访问或网络连接
  • 如果你提供的MS Access足够的安全级别。
  • 可扩展性
  • 等等...

MS Access允许看表的内容,这意味着,当您保存您的用户资料任何用户访问表可以看到用户的详细信息,并能够使用/绕过它们。

MS Access allows to see the table contents which means, When you save your user details any user has access to the table will see the user details and able to use/bypass them.

您得到某种安全编译 Access数据库到一个MDE或ACCDE将prevent用户访问VBA函数或进入设计模式。这将有可能帮助你在许多方面,增加安全性。包括你的前端应用程序的发布更新。

You get some sort of security when you compile your Access database into a MDE or ACCDE which will prevent user accessing VBA functions or going into design mode. This will potentially help you in many ways to increase the security. Including releasing updates of your front-end application.

要回答你关于用户访问级别的问题。我个人其他任何东西在整个应用程序进行集中数据之前拆分数据库。如果你的应用是相当小的,你可以follwo本教程为一个简单的登录表单功能。 http://www.databasedev.co.uk/login.html

To answer your question regarding user access level. I would personally split the database before anything else to maintain centralized data throughout the application. if your application is fairly small, you can follwo this tutorial for a simple login form function. http://www.databasedev.co.uk/login.html

要区分用户的水平,你需要创建一个用户角色表,并为每个用户分配角色。创建一个新的功能,它检查是否用户已经/被分配到所请求的角色如果是允许执行的操作。如果不向用户发出警告。是这样的:

To distinguish user levels you need to create a user role table and assign roles for each user. Create a new function which checks if a user has/is assigned to the requested roles if yes allow to perform the action. If not warn the user. something like this:

表所示:

  • tbl_user:{USER_ID,用户名...}
  • tbl_roles:{ROLE_ID,ROLE_NAME,...}
  • tbl_user_roles:{ROLE_ID,USER_ID,assigned_date,...}

一个简单的函数来检查用户等级:

a simple function to check the user level:

Public Function FN_IS_USER_IN_ROLE(iUSER_ID As Long, iREQ_ROLE As String) As Boolean

    Dim MyDB As Database
    Dim MyRS As Recordset

   On Error GoTo FN_IS_USER_IN_ROLE_Error

    FN_IS_USER_IN_ROLE = False
    Dim SQL_GET As String
    SQL_GET = "SELECT tbl_user.user_name, tbl_roles.role_name " & _
              "FROM (tbl_user_roles INNER JOIN tbl_user ON tbl_user_roles.user_Id = tbl_user.user_id) INNER JOIN tbl_roles ON tbl_user_roles.role_id = tbl_roles.role_id " & _
              "WHERE (((tbl_user.user_id)=" & iUSER_ID & ") AND ((tbl_roles.role_name)='" & iREQ_ROLE & "')); "

    Set MyDB = CurrentDb
    Set MyRS = MyDB.OpenRecordset(SQL_GET)
    Dim mRc As Long
    mRc = Nz(MyRS.RecordCount, 0)
    If mRc > 0 Then
        FN_IS_USER_IN_ROLE = True
    End If


   On Error GoTo 0
    Set MyRS = Nothing
    Set MyDB = Nothing
   Exit Function

FN_IS_USER_IN_ROLE_Error:
    FN_IS_USER_IN_ROLE = False
    Dialog.Box "Error " & Err.Number & " (" & Err.description & ") in procedure FN_IS_USER_IN_ROLE", vbExclamation
End Function

和检查用户是否有足够的权限只需:

and check if the user has enough privilege simply by:

Dim PR As String
PR = "Admin"
If (FN_IS_USER_IN_ROLE(PR)) Then
    'Do something
Else
    'Me.Undo
    'Cancel = True
    MsgBox "You do not have sufficient permissions to perform this task!" & vbNewLine & "Required access level: " & PR, vbCritical, "Access denied.."
    Exit Sub
End If

试试这个,让我们知道,如果你成功了。

Try this and let us know if you succeed.

这篇关于Microsoft Access用户密码限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆