iT邦幫忙

0

ACCESS如何設定權限讓使用者開啟限定的表單

我是新手,我用的ACCESS製作帳號密碼登入後,想要設定權限讓使用者開啟限定的表單請問如何解決阿~
欄位叫"權限",想分別為"管理、檢核、一般"這三種的權限~~

Private Sub Command5_Click()
If IsNull(Me!Text1) = True Or Me!Text1 = "" Then
MsgBox "帳號欄空白!"
Text1.SetFocus '<====回欄位1
Exit Sub
Else
If IsNull(Me!Text3) = True Or Me!Text3 = "" Then
MsgBox "密碼欄空白!"
Text3.SetFocus
Exit Sub
End If
End If
If IsNull(DLookup("user", "員工基本資料", "user='" & Text1 & "'")) Then
MsgBox "帳號錯誤"
Text1.SetFocus '<====回欄位1等帳號正確在執行下方驗證密碼
Exit Sub
Else
username = DLookup("員工姓名", "員工基本資料", "user='" & Text1 & "' and userpassword='" & Text3 & "'")
If IsNull(username) Then
MsgBox "密碼錯誤"
Text3.SetFocus '<====回欄位2
Exit Sub
Forms![開始介面]![權限].Caption = rd("UserLevel") '記錄輸入之管理員權限
Forms![開始介面]![專案清單].Enabled = False '不啟用
If rd("UserLevel") = "管理" Or rd("UserLevel") = "檢核" Or rd("UserLevel") = "一般" Then
Forms![開始介面]![專案清單].Enabled = True '啟用
End If
End If
MsgBox "登入成功"
DoCmd.OpenForm "開始介面"
Forms![開始介面]![txtUser] = username '顯示姓名
DoCmd.Close acForm, "登入"
End Sub


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
GJ
iT邦好手 1 級 ‧ 2020-10-20 09:27:24

最簡單就是把三種權限設定代碼

可以是數字或英文,可利用比大小或代碼對照

決定USER可否存取表單,要在哪個步驟去卡就看你

我要發表回答

立即登入回答