7. Cách khóa fím Shift Bấm "modules" tab New. (Bạn có thể mở 1 module khác nếu có sẵn) * Lưu ý: Phải chắc chắn là thư viện DAO 3.6 được chọn: Chọn Tools References , tìm và chọn Microsoft DAO 3.6 Object LibraryChép function sau đây vào module và lưu với tên bất kỳ (khácDisableShiftKeyBypass).
Nội dung trích xuất từ tài liệu:
Cách khóa phím và login bảo mật 7. Cách khóa fím ShiftBấm modules tab > New. (Bạn có thể mở 1 module khác nếu có sẵn)* Lưu ý: Phải chắc chắn là thư viện DAO 3.6 được chọn:Chọn Tools > References , tìm và chọn Microsoft DAO 3.6 Object LibraryChép function sau đây vào module và lưu với tên bất kỳ (khácDisableShiftKeyBypass).---------Bắt đầu----------Function DisableShiftKeyBypass() As BooleanOn Error GoTo errDisableShiftDim db As DatabaseDim prop As DAO.PropertySet db = CurrentDb()On Error Resume Nextdb.Properties.Delete AllowByPassKeyOn Error GoTo errDisableShiftSet prop = db.CreateProperty(AllowByPassKey, dbBoolean, False, True)db.Properties.Append propDisableShiftKeyBypass = TrueexitDisableShift:Set prop = NothingSet db = NothingExit FunctionerrDisableShift:MsgBox Function DisableShiftKeyBypass did not complete successfully.DisableShiftKeyBypass = FalseResume exitDisableShiftEnd Function----------------Kết thúc---------------------Vào Debug, Compile, và đóng module lại để lưu.Tại database window, Gõ Ctrl-G để mở debug window.Gõ: DisableShiftKeyBypass và bấm Enter.Lần sau khi mở lại, phím Shift sẽ bị vô hiệu hóa.(Bạn chỉ cần chạy 1 lần duy nhất - Trong trường hợp cần phục hồi lại phímShift, bạn sẽ cần đến file đã sao lưu, hoặc phục hồi từ một database khác).8. Bảo mật không cho chỉnh sửa form và report trong file *.mdbTOI GUI CHO BAN 1 MACRO de bao mat ACCESS tuyet voiNhung nho sao luu du phong truoc khi quay khong biet thi hoi toihhnguyen@picotrack.com*****************************************Hàm ChangeProperty thay doi các thuoc tính cua CSDLFunction ChangeProperty(strPropName, varPropType, varPropValue)Dim dbs As Database, prp As PropertyConst conPropNotFoundError = 3270Set dbs = CurrentDbOn Error GoTo Change_XuLyLoidbs.Properties(strPropName) = varPropValueChangeProperty = TrueChange_KetThuc:Exit FunctionChange_XuLyLoi:Thuoc tinh khong thayIf Err = conPropNotFoundError ThenSet prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)dbs.Properties.Append prpResume NextElseKhông biet loi gìChangeProperty = FalseResume Change_KetThucEnd IfEnd FunctionXu lý tình huong chon nút [Khóa database]Private Sub cmdLock_Click()Bieu mau này duoc nap truocIf txtPassword = nguyenhuuhoang361983 ThenChangeProperty StartupForm, dbText, Form1ChangeProperty StartupShowDBWindow, dbBoolean, FalseChangeProperty StartupShowStatusBar, dbBoolean, FalseChangeProperty AllowBuiltinToolbars, dbBoolean, FalseChangeProperty AllowFullMenus, dbBoolean, FalseChangeProperty AllowBreakIntoCode, dbBoolean, FalseChangeProperty AllowSpecialKeys, dbBoolean, FalseKhông cho xài phím Shift de bo qua bieu mau frmKhoiDongChangeProperty AllowBypassKey, dbBoolean, FalseMsgBox Co so du lieu dã duoc khóa! Ðe nghi dóng CSDL lai., vbOKOnly,Thong baocmdExit.SetFocuscmdUnLock.Visible = TruecmdLock.Visible = FalsetxtPassword.Visible = TrueElseMsgBox Ten nguoi su dung khong dung ! , vbOKOnly, Thong baoEnd IftxtPassword = End SubXu lý tình huong chon nút [Mo database]Private Sub cmdUnLock_Click()Không can bieu mau khoi dong nuaIf txtPassword = nguyenhuuhoang361983 ThenChangeProperty StartupForm, dbText, ChangeProperty StartupShowDBWindow, dbBoolean, TrueChangeProperty StartupShowStatusBar, dbBoolean, TrueChangeProperty AllowBuiltinToolbars, dbBoolean, TrueChangeProperty AllowFullMenus, dbBoolean, TrueChangeProperty AllowBreakIntoCode, dbBoolean, TrueChangeProperty AllowSpecialKeys, dbBoolean, TrueChangeProperty AllowBypassKey, dbBoolean, TrueMsgBox Co so du lieu dã duoc mo khóa ! Ðe nghi dóng CSDL lai., vbOKOnly,Thong baocmdExit.SetFocuscmdLock.Visible = TruecmdUnLock.Visible = FalsetxtPassword.Visible = TrueElseMsgBox Ten nguoi su dung khong dung !, vbOKOnly, Thong baoEnd IftxtPassword = End SubXu lý tình huong khi mo bieu mauPrivate Sub Form_Open(Cancel As Integer)Dim dbs As DatabaseSet dbs = CurrentDbOn Error GoTo KhongCoThuocTinh_ErrIf dbs.Properties(AllowBypassKey) ThencmdLock.Visible = TruecmdUnLock.Visible = FalsetxtPassword.Visible = TrueElsecmdLock.Visible = FalsecmdUnLock.Visible = TruetxtPassword.Visible = TrueEnd IfExit SubKhongCoThuocTinh_Err:cmdLock.Visible = TruecmdUnLock.Visible = TruetxtPassword.Visible = TruetxtPassword = End SubKhi nguoi ta go mat khau va an phím EnterPrivate Sub txtPassword_LostFocus()If txtPassword = nguyenhuuhoang361983 ThencmdUnLock.Visible = TrueEnd IfEnd SubPrivate Sub cmdExit_Click()On Error GoTo Err_cmdExit_ClickDoCmd.CloseExit_cmdExit_Click:Exit SubErr_cmdExit_Click:MsgBox Err.DescriptionResume Exit_cmdExit_ClickEnd Sub************************************************code nay do nguoi khac viet , toi chi tham khao thoi