By Pass Keys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adonis Walmsley-McCarthy

    #1

    By Pass Keys

    Dear all,

    Does anybody know how to disable the bypass key ("SHIFT") which is used at
    startup?

    Thanks in advance,

    Adonis.



  • Stewart Allen

    #2
    Re: By Pass Keys

    Hi Adonis,

    Paste the following code into a module and then call it via the immediate
    window by pressing <Ctrl G>, then typing DisableShiftKey ByPass and pressing
    <Enter>. The next time the database is opened the shift key is disabled. To
    convert the shift key back to normal change the "False" in
    db.Properties(" AllowByPassKey" ) = False to True.

    Function DisableShiftKey ByPass() As Boolean
    ' The next time the database is opened
    ' after this function is run,
    ' the autoexec macro will not be bypassed,
    ' even if the shift key is pressed.
    On Error GoTo errDisableShift
    Dim db As Database
    Dim prop As Property
    Const conPropNotFound = 3270
    Set db = CurrentDb()
    db.Properties(" AllowByPassKey" ) = False
    DisableShiftKey ByPass = True

    exitDisableShif t:
    Exit Function

    errDisableShift :
    ' The AllowByPassKey property is a user-defined
    ' property of the database that must be created
    ' before it can be set. This error code will execute
    ' the first time this function is run in a database.
    If Err = conPropNotFound Then
    Set prop = db.CreateProper ty("AllowByPass Key", dbBoolean, False)
    db.Properties.A ppend prop
    Resume Next
    Else
    MsgBox "Function DisableShiftKey ByPass did" & "not complete
    successfully."
    DisableShiftKey ByPass = False
    GoTo exitDisableShif t
    End If
    End Function


    "Adonis Walmsley-McCarthy" <awne01411@blue yonder.co.uk> wrote in message
    news:4nrnb.4938 $RD3.2175@news-binary.blueyond er.co.uk...[color=blue]
    > Dear all,
    >
    > Does anybody know how to disable the bypass key ("SHIFT") which is used at
    > startup?
    >
    > Thanks in advance,
    >
    > Adonis.
    >
    >
    >[/color]


    Comment

    • Terry Kreft

      #3
      Re: By Pass Keys


      You haven't set the DDL parameter on the CreateProperty method to True.

      This means that anybody who can open the database can run code to switch
      this off.

      Set prop = db.CreateProper ty("AllowByPass Key", dbBoolean, False)

      Should be
      Set prop = db.CreateProper ty("AllowByPass Key", dbBoolean, False,
      True)


      Terry

      "Stewart Allen" <sagasu@ThisPar tNotVailid.wave .co.nz> wrote in message
      news:bnlism$anb $1@news.wave.co .nz...[color=blue]
      > Hi Adonis,
      >
      > Paste the following code into a module and then call it via the immediate
      > window by pressing <Ctrl G>, then typing DisableShiftKey ByPass and[/color]
      pressing[color=blue]
      > <Enter>. The next time the database is opened the shift key is disabled.[/color]
      To[color=blue]
      > convert the shift key back to normal change the "False" in
      > db.Properties(" AllowByPassKey" ) = False to True.
      >
      > Function DisableShiftKey ByPass() As Boolean
      > ' The next time the database is opened
      > ' after this function is run,
      > ' the autoexec macro will not be bypassed,
      > ' even if the shift key is pressed.
      > On Error GoTo errDisableShift
      > Dim db As Database
      > Dim prop As Property
      > Const conPropNotFound = 3270
      > Set db = CurrentDb()
      > db.Properties(" AllowByPassKey" ) = False
      > DisableShiftKey ByPass = True
      >
      > exitDisableShif t:
      > Exit Function
      >
      > errDisableShift :
      > ' The AllowByPassKey property is a user-defined
      > ' property of the database that must be created
      > ' before it can be set. This error code will execute
      > ' the first time this function is run in a database.
      > If Err = conPropNotFound Then
      > Set prop = db.CreateProper ty("AllowByPass Key", dbBoolean, False)
      > db.Properties.A ppend prop
      > Resume Next
      > Else
      > MsgBox "Function DisableShiftKey ByPass did" & "not complete
      > successfully."
      > DisableShiftKey ByPass = False
      > GoTo exitDisableShif t
      > End If
      > End Function
      >
      >
      > "Adonis Walmsley-McCarthy" <awne01411@blue yonder.co.uk> wrote in message
      > news:4nrnb.4938 $RD3.2175@news-binary.blueyond er.co.uk...[color=green]
      > > Dear all,
      > >
      > > Does anybody know how to disable the bypass key ("SHIFT") which is used[/color][/color]
      at[color=blue][color=green]
      > > startup?
      > >
      > > Thanks in advance,
      > >
      > > Adonis.
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Stewart Allen

        #4
        Re: By Pass Keys

        Thanks for that Terry. I've just looked at the sample at
        http://www.mvps.org/access/general/gen0040.htm and will start using that
        code instead.

        Stewart


        "Terry Kreft" <terry.kreft@mp s.co.uk> wrote in message
        news:bnm2b1$ef7 $1@newsreaderg1 .core.theplanet .net...[color=blue]
        >
        > You haven't set the DDL parameter on the CreateProperty method to True.
        >
        > This means that anybody who can open the database can run code to switch
        > this off.
        >
        > Set prop = db.CreateProper ty("AllowByPass Key", dbBoolean, False)
        >
        > Should be
        > Set prop = db.CreateProper ty("AllowByPass Key", dbBoolean, False,
        > True)
        >
        >
        > Terry
        >
        > "Stewart Allen" <sagasu@ThisPar tNotVailid.wave .co.nz> wrote in message
        > news:bnlism$anb $1@news.wave.co .nz...[color=green]
        > > Hi Adonis,
        > >
        > > Paste the following code into a module and then call it via the[/color][/color]
        immediate[color=blue][color=green]
        > > window by pressing <Ctrl G>, then typing DisableShiftKey ByPass and[/color]
        > pressing[color=green]
        > > <Enter>. The next time the database is opened the shift key is disabled.[/color]
        > To[color=green]
        > > convert the shift key back to normal change the "False" in
        > > db.Properties(" AllowByPassKey" ) = False to True.
        > >
        > > Function DisableShiftKey ByPass() As Boolean
        > > ' The next time the database is opened
        > > ' after this function is run,
        > > ' the autoexec macro will not be bypassed,
        > > ' even if the shift key is pressed.
        > > On Error GoTo errDisableShift
        > > Dim db As Database
        > > Dim prop As Property
        > > Const conPropNotFound = 3270
        > > Set db = CurrentDb()
        > > db.Properties(" AllowByPassKey" ) = False
        > > DisableShiftKey ByPass = True
        > >
        > > exitDisableShif t:
        > > Exit Function
        > >
        > > errDisableShift :
        > > ' The AllowByPassKey property is a user-defined
        > > ' property of the database that must be created
        > > ' before it can be set. This error code will execute
        > > ' the first time this function is run in a database.
        > > If Err = conPropNotFound Then
        > > Set prop = db.CreateProper ty("AllowByPass Key", dbBoolean, False)
        > > db.Properties.A ppend prop
        > > Resume Next
        > > Else
        > > MsgBox "Function DisableShiftKey ByPass did" & "not complete
        > > successfully."
        > > DisableShiftKey ByPass = False
        > > GoTo exitDisableShif t
        > > End If
        > > End Function
        > >
        > >
        > > "Adonis Walmsley-McCarthy" <awne01411@blue yonder.co.uk> wrote in message
        > > news:4nrnb.4938 $RD3.2175@news-binary.blueyond er.co.uk...[color=darkred]
        > > > Dear all,
        > > >
        > > > Does anybody know how to disable the bypass key ("SHIFT") which is[/color][/color][/color]
        used[color=blue]
        > at[color=green][color=darkred]
        > > > startup?
        > > >
        > > > Thanks in advance,
        > > >
        > > > Adonis.
        > > >
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...