Nasao sam i resenje za iskljucivanje shifta u ADP-u. Razlikuje se od MDB-a po tome sto se drugacije koriste property-ji. Napisao sam ovaj modul za baratanje property-jima i sadrzi funkciju koja ukljucuje/iskljucuje shift taster.
Code:
Option Compare Database
Option Explicit
Function PropertyExists(PropertyName As String) As Boolean
On Error GoTo PropertyExists_Error
PropertyExists = False
If Application.CurrentProject.Properties(PropertyName).Name <> PropertyName Then GoTo PropertyExists_Error
PropertyExists = True
PropertyExists_Error:
End Function
Function GetPropertyValue(PropertyName As String, Default As Variant) As Variant
On Error GoTo GetPropertyValue_Error
GetPropertyValue = Default
If PropertyExists(PropertyName) Then GetPropertyValue = Application.CurrentProject.Properties(PropertyName).Value
GetPropertyValue_Error:
End Function
Function SetPropertyValue(PropertyName As String, Value As Variant) As Boolean
On Error GoTo SetPropertyValue_Error
SetPropertyValue = False
If PropertyExists(PropertyName) Then
Application.CurrentProject.Properties(PropertyName).Value = Value
SetPropertyValue = True
Else
Application.CurrentProject.Properties.Add PropertyName, Value
SetPropertyValue = True
End If
SetPropertyValue_Error:
End Function
Function RemoveProperty(PropertyName As String) As Boolean
On Error GoTo RemoveProperty_Error
RemoveProperty = False
If PropertyExists(PropertyName) Then Application.CurrentProject.Properties.Remove PropertyName
RemoveProperty = True
RemoveProperty_Error:
End Function
Function IsShiftKeyEnabled() As Boolean
IsShiftKeyEnabled = Not PropertyExists("AllowBypassKey")
End Function
Function EnableShiftKey(Enable As Boolean) As Boolean
Dim PropertyName As String
PropertyName = "AllowBypassKey"
If Not Enable And Not PropertyExists(PropertyName) Then SetPropertyValue PropertyName, 0
If Enable And PropertyExists(PropertyName) Then RemoveProperty PropertyName
EnableShiftKey = IsShiftKeyEnabled
End Function
Iako ove funkcije za propertije mogu da rade i u MDB-u, iskljucivanje/ukljucivanje shifra sa ovim kodom ne funkcionise u MDB-u jer se u MDB-u ne koriste Application.CurrentProject.Properties vec CurrentDb.Properties.