If UserName = "your user name" Then
ChangeProperty "AllowBypassKey", 1, True ' Allows ByPass
Else
ChangeProperty "AllowBypassKey", 1, False ' Prohibits ByPass
End If
"kerry" wrote:
> Is it possible to set my login to always turn the Shift key bypass to on? If
> so, how would I go about doing something like that?
>
> We do have security within the database setup so each user has there own
> username and password. The reason I need my username and password to always
> turn the bypass key on is because the previous programmer didn't keep the
> frontends all the same for each user so I'm having to make changes to each
> one of there frontends because no one knows all of the different changes he
> made.
>
> Thanks a lot for your help so far. I appreciate it.
>
> "Klatuu" wrote:
>
> > Here is the code from one of my apps:
> >
> > Called like this:
> > ChangeProperty "AllowBypassKey", 1, True ' Allows ByPass
> > or
> > ChangeProperty "AllowBypassKey", 1, False ' Prohibits ByPass
> >
> > This is the function:
> > Function ChangeProperty(strPropName As String, varPropType As Variant,
> > blnPropValue 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) = blnPropValue
> > ChangeProperty = True
> >
> > Change_Bye:
> > Exit Function
> >
> > Change_Err:
> > If Err = conPropNotFoundError Then ' Property not found.
> > Set prp = dbs.CreateProperty(strPropName, _
> > varPropType, blnPropValue)
> > dbs.Properties.Append prp
> > Resume Next
> > Else
> > ' Unknown error.
> > ChangeProperty = False
> > Resume Change_Bye
> > End If
> > End Function
> >
> > Now, as to getting in for developement. There are a couple of ways to do
> > this.
> >
> > One would be to have a constant in the open event of the startup event that
> > would tell the code whether to turn bypass on or off. Keep the constant
> > value so that it always turns it on (you can get in) in your development
> > copy. Once you are ready to put the app into production and just before you
> > deliver it, change the constant so it turns bypass off.
> >
> > Dim blnByPass As Boolean
> > Const conByPass As Boolean = True
> >
> > ChangeProperty "AllowBypassKey", 1, conByPass ' Allows ByPass
> >
> > If you are using Security you could do what you are considering, and allow
> > only a specifc user name to turn it back on. The only trick is, once you
> > have set it back on, you have to close the mdb and reopen it to get back in.
> >
> > "kerry" wrote:
> >
> > > My switchboard form is set in the startup form option. I have the code under
> > > a module and then I just ran the following in an Intermediate window because
> > > I read another article online from someone that said you should only have to
> > > run it once and the SHIFT key would be disabled for good after that.
> > >
> > > SetProperties "AllowBypassKey", dbBoolean, False 'Dissallow "SHIFT" to
> > > bypass login
> > >
> > > The code below is what runs on the open of the Switchboard form. Is there
> > > something wrong with this? OR do I have the AllowBypassKey code in the wrong
> > > place? My other question is how do I make a different set of shortcut keys or
> > > something else so me as an ADMIN can still bypass the startup form etc.?
> > >
> > > Private Sub Form_Open(Cancel As Integer)
> > > ' Minimize the database window and initialize the form.
> > >
> > > ' Move to the switchboard page that is marked as the default.
> > > Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
> > > Me.FilterOn = True
> > >
> > > End Sub
> > >
> > >
> > > "Klatuu" wrote:
> > >
> > > > The two are not related. There is something else you are doing that is
> > > > causing your switchboard not to open. Is your switchboard identified in the
> > > > startup form/page option? If not, what is? Where are you running the code
> > > > below from?
> > > >
> > > >
> > > > "kerry" wrote:
> > > >
> > > > > When I run the code that turns off the ability to use the SHIFT key to get
> > > > > into the database it won't open my switchboard form now. What do I need to in
> > > > > order to turn off the SHIFT key ability and to have the switchboard form open
> > > > > and the database works as it normally would?
> > > > >
> > > > > The code that I'm using right now for the SHIFT key turnoff:
> > > > >
> > > > > Public Function SetProperties(strPropName As String, varPropType As Variant,
> > > > > varPropValue As Variant) As Integer
> > > > >
> > > > > On Error GoTo Err_SetProperties
> > > > > Dim db As DAO.Database, prp As DAO.Property
> > > > > Set db = Currentdb
> > > > > db.Properties(strPropName) = varPropValue
> > > > > SetProperties = True
> > > > > Set db = Nothing
> > > > >
> > > > > Exit_SetProperties:
> > > > > Exit Function
> > > > >
> > > > > Err_SetProperties:
> > > > > If Err = 3270 Then 'Property not found
> > > > > Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
> > > > > db.Properties.Append prp
> > > > > Resume Next
> > > > > Else
> > > > >
> > > > > SetProperties = False
> > > > > MsgBox "SetProperties", Err.Number, Err.Description
> > > > > Resume Exit_SetProperties
> > > > > End If
> > > > > End Function
> > > > >
|