đăng 20:22 27 thg 3, 2012 bởi Hai Yen
[
đã cập nhật 07:32 16 thg 9, 2014
]
Xây dựng xong CT nhân sự (C:\QLNS.mdb). Tạo 1 custom menu bar, giấu đi Main menu của Access, tạo form startup, disable phím Shift để không ai có thể mở được cửa sổ database. Sau một thời gian CT bị lỗi nhưng lại quên viết code enable phím Shift nên không tài nào mở của sổ database, mở cửa sổ viết code để sửa lại CT. Rất đơn giản, hay tạo 1 file .mdb mới , viết code để can thiệp vào file QLNS.mdb, enable phím Shift.Cách làm: Trong file .mdb mới, bạn tạo 1 form, tạo 1 command button và : Private Sub EnableSHIFTButton_Click()
On Error GoTo ErrHandler
Dim db As Database Dim ThuocTinh As Property
Set db = OpenDatabase("C:\QLNS.mdb") db.Properties("AllowBypassKey") = True Set db = Nothing
Exit Sub ErrHandler: MsgBox Err.Number If Err.Number = 3270 Then ' Property not found. Set ThuocTinh = db.CreateProperty("AllowBypassKey", dbBoolean, True) db.Properties.Append ThuocTinh Resume Next Else MsgBox Err.Description End If End Sub |
|