-
Khoá phím shift + khóa Design View trong access
Cuong Servenet > 22-08-18, 01:47 PM
Có anh chị nào biết cách khóa phím shift với khóa không cho Design View trong access thì chỉ em với
trường hợp muốn xem fai có nhập mật khẩu
Ngoài ra có cách nào khóa đc bảng bằng code ko nhỉ?
em cảm ơn ạ -
RE: Khoá phím shift + khóa Design View trong access
tranthanhan1962 > 22-08-18, 02:18 PM
Code VBA khóa và mở khóa shift:
Khóa:
Mã:Public Function Disable_ShiftKey()
Dim db As Database
Dim prp, prptest As Property
On Error GoTo Err_Handler
Set db = CurrentDb
For Each prptest In db.Properties
If prptest.Name = "AllowBypassKey" Then
db.Properties.Delete "AllowBypassKey"
Exit For
End If
Next prptest
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, False, True)
db.Properties.Append prp
db.Properties.Refresh
MsgBox "Disable Shift Key succeeded!", vbInformation
Set db = Nothing
Set prp = Nothing
Err_Exit:
Exit Function
Err_Handler:
MsgBox "Error " & Err.Number & " ! " & Err.Description, vbCritical
Resume Err_Exit
End Function
Mở khóa:
Theo tôi biết thì chỉ có ẩn container giao diện access startup/ bỏ check Display Database Windows. Khi ẩn sẽ không ai còn thấy table nữa. Khóa shift thì phải xủ lý cách mở shift chứ nếu không thì khóa luôn cả mình đóMã:Public Function Enable_ShiftKey()
Dim db As Database
Dim prp, prptest As Property
On Error GoTo Err_Handler
Set db = CurrentDb
For Each prptest In db.Properties
If prptest.Name = "AllowBypassKey" Then
db.Properties.Delete "AllowBypassKey"
Exit For
End If
Next prptest
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, True, True)
db.Properties.Append prp
db.Properties.Refresh
MsgBox "Enable Shift Key succeeded!", vbInformation
Set db = Nothing
Set prp = Nothing
Err_Exit:
Exit Function
Err_Handler:
MsgBox "Error " & Err.Number & " ! " & Err.Description, vbCritical
Resume Err_Exit
End Function