Disable AllowByPass Using ADO

  • Thread starter Thread starter Lynn
  • Start date Start date
L

Lynn

Does anyone have the code to disable the shift key using
ADO. I can find tons of examples using DAO, but need to
do this in ADO.

thanks
 
Does anyone have the code to disable the shift key using
ADO. I can find tons of examples using DAO, but need to
do this in ADO.

You want this for an ADP, correct? Using CurrentProject will not work for
MDB where you must use the Access.Properties collection. In ADP, you have
to use CurrentProject.AccessObjectProperties (as noted in help for
AllowBypassKey).

' *** Code Start ***
Sub SetAllowBypassKey(value As Boolean)
Call ChangeProperty_ADP("AllowBypassKey", value)
End Sub

Sub CheckAllowBypassKey()
On Error Resume Next
Debug.Print Application.CurrentProject. _
Properties("AllowBypassKey")
End Sub

Sub ChangeProperty_ADP(propertyName As String, _
propertyValue As Variant)
Dim props As AccessObjectProperties
Dim prop As AccessObjectProperty
Dim isPresent As Boolean

Set props = Application.CurrentProject.Properties
For Each prop In props
If (StrComp(prop.Name, propertyName, vbTextCompare) = 0) Then
isPresent = True
Exit For
End If
Next

If (isPresent) Then
props(propertyName).value = propertyValue
Else
props.Add propertyName, propertyValue
End If
End Sub
' *** Code End ***

-- Dev
 
Back
Top