Na login formu postavis komandno dugme,pod nazivom recimo u ovom slucaju bIskljuciShift i dodelis mu na dogadjaj OnClick sledeci kod
Code:
Private Sub bIskljuciShift_Click()
On Error GoTo Err_bIskljuciShift_Click
Dim strInput As String
Dim strMsg As String
Beep
strMsg = "Zelite li omoguciti SHIFT key?" & vbCrLf & vbLf & _
"Molimo Vas upisite sifru za omogucivanje SHIFT key-a."
strInput = InputBox(Prompt:=strMsg, Title:="Shift key nije omogucen")
If strInput = "1111" Then 'neka tvoja sifra
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "Shift key je ukljucen." & vbCrLf & vbLf & _
"Sledeci put kad budete otvarali vasu bazu Shift key ce biti omogucen.", _
vbInformation, "Set Startup Properties"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Sifra nije prihvacena!" & vbCrLf & vbLf & _
"Shift key je onemogucen." & vbCrLf & vbLf & _
"Sledeci put kad budete otvarali bazu Shift key ce biti onemogucen.", _
vbCritical, "Netacna sifra"
Exit Sub
End If
Exit_bIskljuciShift_Click:
Exit Sub
Err_bIskljuciShift_Click:
MsgBox "bIskljuciShift_Click", Err.Number, Err.Description
Resume Exit_bIskljuciShift_Click
End Sub
.Klikom na njega namerno upises pogresnu sifru i shift je onemogucen.Kad zelis da omogucis shift kliknes i ukucas pravu sifru i to je to.Kod za iskljucivanje postavis u novi modul:
Code:
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
Dim Db As DAO.Database, prp As DAO.Property
Set Db = CurrentDb
Db.Properties(strPropName) = varPropValue
SetProperties = True
Set Db = Nothing
Exit_SetProperties:
Exit Function
Err_SetProperties:
If Err = 3270 Then
Set prp = Db.CreateProperty(strPropName, varPropType, varPropValue)
Db.Properties.Append prp
Resume Next
Else
SetProperties = False
MsgBox "SetProperties", Err.Number, Err.Description
Resume Exit_SetProperties
End If
End Function
Jednog dana...