dbTalk Databases Forums  

AllowBypassKey property not working

comp.databases.ms-access comp.databases.ms-access


Discuss AllowBypassKey property not working in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jim Mandala
 
Posts: n/a

Default AllowBypassKey property not working - 08-17-2010 , 12:43 PM






I am trying to prevent end users from being able to use the SHIFT key
to bypass the Autoexec and see the data tables. I used following code
from Microsoft to create and set the "AllowBypassKey property to
false, but the database seems to still bypass the Autoexec and shows
the Navigation Pane and all menus. Any thoughts? Thanks!

Option Compare Database

Sub SetBypassProperty()
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey ", DB_Boolean, False
End Sub

Function ChangeProperty(strPropName As String, _
varPropType As Variant, _
varPropValue As Variant) As Integer

Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Debug.Print strPropName & " " & varPropValue
Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: AllowBypassKey property not working - 08-17-2010 , 01:49 PM






Jim Mandala wrote:

Quote:
I am trying to prevent end users from being able to use the SHIFT key
to bypass the Autoexec and see the data tables. I used following code
from Microsoft to create and set the "AllowBypassKey property to
false, but the database seems to still bypass the Autoexec and shows
the Navigation Pane and all menus. Any thoughts? Thanks!

Option Compare Database

Sub SetBypassProperty()
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey ", DB_Boolean, False
End Sub

Function ChangeProperty(strPropName As String, _
varPropType As Variant, _
varPropValue As Variant) As Integer

Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Debug.Print strPropName & " " & varPropValue
Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
What happens if you enter from the immediate window
? ChangeProperty("AllowBypassKey ", dbBoolean, False)
Does it return true or false? You might want to know what the result of
running the code was.

What happens if you run this code to see if the Bypass property exists.
Public Function BypassExist() As Boolean
'verify that the bypass property exists or not
Dim dbs As DAO.Database
Dim prp As DAO.Property

Set dbs = CurrentDb()


On Error GoTo 0
On Error Resume Next
BypassExist = dbs.Properties("AllowByPassKey")
BypassExist = (Err.Number = 0)
End Function

What happens if the property does exist you enter
? CurrentDb.Properties("AllowByPassKey").Value

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.