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@mps.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.CreateProperty("AllowByPassKey", dbBoolean, False)
>
> Should be
> Set prop = db.CreateProperty("AllowByPassKey", dbBoolean, False,
> True)
>
>
> Terry
>
> "Stewart Allen" <sagasu@ThisPartNotVailid.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 DisableShiftKeyByPass 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 DisableShiftKeyByPass() 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
> > DisableShiftKeyByPass = True
> >
> > exitDisableShift:
> > 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.CreateProperty("AllowByPassKey", dbBoolean, False)
> > db.Properties.Append prop
> > Resume Next
> > Else
> > MsgBox "Function DisableShiftKeyByPass did" & "not complete
> > successfully."
> > DisableShiftKeyByPass = False
> > GoTo exitDisableShift
> > End If
> > End Function
> >
> >
> > "Adonis Walmsley-McCarthy" <awne01411@blueyonder.co.uk> wrote in message
> > news:4nrnb.4938$RD3.2175@news-binary.blueyonder.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]