Home All Groups Group Topic Archive Search About

disallowing SHIFT Bypass

Author
16 Mar 2007 12:19 PM
arista
Hi

after a long time playing with disallowing SHIFT Bypass I decided to ask you
for help.
I did following:
1) paste function ChangePropertyDdl into separate module called Security
(function from recommended web site
http://www.mvps.org/access/general/gen0040.htm)

Public Function ChangePropertyDdl(stPropName As String, _
PropType As DAO.DataTypeEnum, vPropVal As Variant) _
As Boolean
' Uses the DDL argument to create a property
' that only Admins can change.
'
' Current CreateProperty listing in Access help
' is flawed in that anyone who can open the db
' can reset properties, such as AllowBypassKey
'
    On Error GoTo ChangePropertyDdl_Err

    Dim db As DAO.Database
    Dim prp As DAO.Property

    Const conPropNotFoundError = 3270

    Set db = CurrentDb
    ' Assuming the current property was created without
    ' using the DDL argument. Delete it so we can
    ' recreate it properly
    db.Properties.Delete stPropName
    Set prp = db.CreateProperty(stPropName, _
     PropType, vPropVal, True)
    db.Properties.Append prp

    ' If we made it this far, it worked!
    ChangePropertyDdl = True

ChangePropertyDdl_Exit:
    Set prp = Nothing
    Set db = Nothing
    Exit Function

ChangePropertyDdl_Err:
    If Err.Number = conPropNotFoundError Then
        ' We can ignore when the prop does not exist
    Resume Next
    End If
    Resume ChangePropertyDdl_Exit
End Function

2) I added DAO 3.6 into references
3) in mdb file I run the function from the immediate window
-> then the file mdb does not allow shift bypass only for the first open; on
second open it is again possible to use shift bypass

4) I made mde file (I export this file to my clients)
5) in mde file I run the function from the button event
-> then the file mde does not allow shift bypass only for the first open; on
second open it is again possible to use shift bypass

I tried several combinations with same result.
Can anybody help please ?


Author
16 Mar 2007 2:07 PM
Joan Wild
Given your description, it sounds like the function is being called
somewhere in your code.

In all your testing, did you perhaps try to call it in the opening of some
form (and forget to remove it from there)?

How are you running the function?

--
Joan Wild
Microsoft Access MVP
Show quoteHide quote
"arista" <u15408@uwe> wrote in message news:6f422ac64b238@uwe...
> Hi
>
> after a long time playing with disallowing SHIFT Bypass I decided to ask
> you
> for help.
> I did following:
> 1) paste function ChangePropertyDdl into separate module called Security
> (function from recommended web site
> http://www.mvps.org/access/general/gen0040.htm)
>
> Public Function ChangePropertyDdl(stPropName As String, _
> PropType As DAO.DataTypeEnum, vPropVal As Variant) _
> As Boolean
> ' Uses the DDL argument to create a property
> ' that only Admins can change.
> '
> ' Current CreateProperty listing in Access help
> ' is flawed in that anyone who can open the db
> ' can reset properties, such as AllowBypassKey
> '
>    On Error GoTo ChangePropertyDdl_Err
>
>    Dim db As DAO.Database
>    Dim prp As DAO.Property
>
>    Const conPropNotFoundError = 3270
>
>    Set db = CurrentDb
>    ' Assuming the current property was created without
>    ' using the DDL argument. Delete it so we can
>    ' recreate it properly
>    db.Properties.Delete stPropName
>    Set prp = db.CreateProperty(stPropName, _
>     PropType, vPropVal, True)
>    db.Properties.Append prp
>
>    ' If we made it this far, it worked!
>    ChangePropertyDdl = True
>
> ChangePropertyDdl_Exit:
>    Set prp = Nothing
>    Set db = Nothing
>    Exit Function
>
> ChangePropertyDdl_Err:
>    If Err.Number = conPropNotFoundError Then
>        ' We can ignore when the prop does not exist
>    Resume Next
>    End If
>    Resume ChangePropertyDdl_Exit
> End Function
>
> 2) I added DAO 3.6 into references
> 3) in mdb file I run the function from the immediate window
> -> then the file mdb does not allow shift bypass only for the first open;
> on
> second open it is again possible to use shift bypass
>
> 4) I made mde file (I export this file to my clients)
> 5) in mde file I run the function from the button event
> -> then the file mde does not allow shift bypass only for the first open;
> on
> second open it is again possible to use shift bypass
>
> I tried several combinations with same result.
> Can anybody help please ?
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-security/200703/1
>
Author
16 Mar 2007 7:07 PM
arista via AccessMonster.com
I need to make SHIFT bypass disabled in mde file. So I run the function every
time on the open event of the initial form.
I realize later that SHIFT bypass is disabled on the first and also the third,
fifth opening but allowed on the second, fourth, sixth, etc. opening.
Any idea why ?

Author
16 Mar 2007 7:40 PM
Joan Wild
Probably in the way you are calling it.   The function is
ChangePropertyDdl(stPropName As String, _
PropType As DAO.DataTypeEnum, vPropVal As Variant) _
As Boolean

How are you calling it?

You only need to run it once, just before your deploy.

Since it only takes effect the next time you open the database, there's no
need to run it every time.

--
Joan Wild
Microsoft Access MVP
"arista via AccessMonster.com" <u15408@uwe> wrote in message
news:6f47883fa04de@uwe...
Show quoteHide quote
>I need to make SHIFT bypass disabled in mde file. So I run the function
>every
> time on the open event of the initial form.
> I realize later that SHIFT bypass is disabled on the first and also the
> third,
> fifth opening but allowed on the second, fourth, sixth, etc. opening.
> Any idea why ?
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-security/200703/1
>
Author
16 Mar 2007 9:06 PM
arista via AccessMonster.com
I call it every time on the first form like this:

Private Sub Form_Open(Cancel As Integer)
    Dim xxx5 As Boolean   
    xxx5 = ChangePropertyDdl("AllowBypassKey", DB_BOOLEAN, False)
End Sub

I stepped into it in mdb file and it goes through. But unfortunately it works
excatly as I described before - only the first, third, fifth, etc. time only.

Author
16 Mar 2007 9:53 PM
Joan Wild
As I said, you don't need to call it every time your mdb opens.  Run it once
from the immediate window, and then ship the mde.

--
Joan Wild
Microsoft Access MVP
"arista via AccessMonster.com" <u15408@uwe> wrote in message
news:6f4891d857aa1@uwe...
Show quoteHide quote
>I call it every time on the first form like this:
>
> Private Sub Form_Open(Cancel As Integer)
>    Dim xxx5 As Boolean
>    xxx5 = ChangePropertyDdl("AllowBypassKey", DB_BOOLEAN, False)
> End Sub
>
> I stepped into it in mdb file and it goes through. But unfortunately it
> works
> excatly as I described before - only the first, third, fifth, etc. time
> only.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-security/200703/1
>
Author
16 Mar 2007 10:19 PM
arista via AccessMonster.com
As I said, it runs only for the first time and then it does not work.

Joan Wild wrote:
Show quoteHide quote
>As I said, you don't need to call it every time your mdb opens.  Run it once
>from the immediate window, and then ship the mde.
>
>>I call it every time on the first form like this:
>>
>[quoted text clipped - 7 lines]
>> excatly as I described before - only the first, third, fifth, etc. time
>> only.

Author
19 Mar 2007 8:14 AM
Keith Wilby
"arista via AccessMonster.com" <u15408@uwe> wrote in message
news:6f4935ed32501@uwe...
> As I said, it runs only for the first time and then it does not work.
>

I'm sorry if this sounds rude but are you deliberately not listening?  You
DON'T need to call the function at all at run-time. Period.  The function
DOES NOT need to be part of your application. Once you've used it to create
and set the property you can delete it.  You can manipulate the property
using Albert Kallal's utility:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

Keith.
Author
19 Mar 2007 8:56 AM
arista via AccessMonster.com
Albert Kallal's utility works. Perfect. Thanks a lot.