UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> My Allowbypasskey Is Not Working, Access 2016    
 
   
SemiAuto40
post Apr 9 2020, 12:41 PM
Post#1



Posts: 744
Joined: 3-April 12
From: L.A. (lower Alabama)


I am calling this from my initial form On_Load event with a call to SetBypassKeyStatus(False). This is still allowing a user to hold shift and launch right into my Access objects! What am I doing wrong or does this no longer work as in years past?
CODE
Public Function SetBypassKeyStatus(SetStatus As Boolean)

   On Error GoTo PROCESS_ERROR
  
   Dim prp As DAO.Property
      
       CurrentDb.Properties("AllowBypassKey") = SetStatus
    
PROCESS_EXIT:
    Exit Function
    
PROCESS_ERROR:
    If Err.Number = 3270 Then
        'Database property doesn't exist - create it and set it
        Set prp = CurrentDb.CreateProperty("AllowBypassKey", dbBoolean, SetStatus)
        CurrentDb.Properties.Append prp
    Else
        MsgBox "/Form_Load error:" & Err.Number & "-" & Err.Description
    End If
    GoTo PROCESS_EXIT
    
End Function
Go to the top of the page
 
theDBguy
post Apr 9 2020, 12:44 PM
Post#2


UA Moderator
Posts: 78,090
Joined: 19-June 07
From: SunnySandyEggo


Hi. Can you still use the Shift Bypass if you close and reopen the database?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
DanielPineault
post Apr 9 2020, 12:53 PM
Post#3


UtterAccess VIP
Posts: 7,336
Joined: 30-June 11



It doesn't take effect until the db is closed and reopened.

So if you deploy it, on first run the user will still be able to use the shift bypass. On the 2nd run, they will no longer be able to. This is why I set the property myself, run it, compact and repair,... and deploy to my users in an already locked state.

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
SemiAuto40
post Apr 9 2020, 12:57 PM
Post#4



Posts: 744
Joined: 3-April 12
From: L.A. (lower Alabama)


Yes even after re-opening. Does this work if I have a password protected back end?
Go to the top of the page
 
DanielPineault
post Apr 9 2020, 01:01 PM
Post#5


UtterAccess VIP
Posts: 7,336
Joined: 30-June 11



Sure.

Try this
CODE
Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
' SetProperties "AllowBypassKey", dbBoolean, True 'Enable Shift Bypass
' SetProperties "AllowBypassKey", dbBoolean, False 'Disable Shift Bypass
    Dim db As DAO.Database
    Dim prp As DAO.Property

On Error GoTo Err_SetProperties
    
    Set db = CurrentDb
    db.Properties(strPropName) = varPropValue
    SetProperties = True
    
Exit_SetProperties:
    Set db = Nothing
    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 "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
        Resume Exit_SetProperties
    End If
End Function

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
theDBguy
post Apr 9 2020, 01:03 PM
Post#6


UA Moderator
Posts: 78,090
Joined: 19-June 07
From: SunnySandyEggo


QUOTE (SemiAuto40)
Yes even after re-opening.

In that case, do you have another set of code that sets it back to True on Exit of your program?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
SemiAuto40
post Apr 9 2020, 01:14 PM
Post#7



Posts: 744
Joined: 3-April 12
From: L.A. (lower Alabama)


Thank you so much for the code! It is working for me.
Thanks to all who give of their time to help. uarulez2.gif
Go to the top of the page
 
SemiAuto40
post Apr 9 2020, 01:31 PM
Post#8



Posts: 744
Joined: 3-April 12
From: L.A. (lower Alabama)


One thing I found was that I had a Validate user routine where I validated that the user was known on the company network. In my case, if it was me, then AllowBypassKeys were set to TRUE.... all others set to FALSE. I don't think I understood at the time that if I was the last one to log on that the setting for subsequent users was then also TRUE! At least that is my understanding of it.
Go to the top of the page
 
theDBguy
post Apr 9 2020, 01:36 PM
Post#9


UA Moderator
Posts: 78,090
Joined: 19-June 07
From: SunnySandyEggo


That sounds like you're all sharing the same FE file, which is not recommended. Is that the case?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
SemiAuto40
post Apr 9 2020, 01:39 PM
Post#10



Posts: 744
Joined: 3-April 12
From: L.A. (lower Alabama)


We are not sharing the same front end file, but when I am done with any changes I make an accde of it and place it on the network for users to make a copy to their own desktop. Should I be doing this differently with regards to the Allowbypasskeys?
Go to the top of the page
 
theDBguy
post Apr 9 2020, 01:41 PM
Post#11


UA Moderator
Posts: 78,090
Joined: 19-June 07
From: SunnySandyEggo


Yes, you should do it like how Daniel described it earlier. Basically, only disable the Shift Bypass when you're ready to deploy the app.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
pere_de_chipstic...
post Apr 9 2020, 04:09 PM
Post#12


UtterAccess Editor
Posts: 10,624
Joined: 8-November 07
From: South coast, England


PMFJI

I run the following code snippet in the start up code of each db:

CODE
dim strMde as String
    With CurrentDb
        On Error Resume Next
        strMDE = .Properties("MDE")                    'If this is an ACCDE or MDE database, disable bypass key
        If Err = 0 And strMDE = "T" Then
            .Properties("AllowByPassKey") = False
        Else
            .Properties("AllowByPassKey") = True
        End If
    End With


When I create an accde/mde I open the database once and then close it before distributing it.

this automatically inhibits the bypasskey in an accde/mde file but allows the bypasskey in an mdb or accdb

hth

--------------------
Warm regards
Bernie
Go to the top of the page
 
DigAtRandom
post Apr 13 2020, 02:50 PM
Post#13



Posts: 22
Joined: 12-July 12
From: Virginia


Checking properties in my Access 2019, it seems that property names are different:
AllowSpecialKeys I believe replaces AllowByPassKey
Then the only property close to "MDI" is UseMDIMode;
These are among other "gotchas" that have turned up in Access 2019 for me.
For what its worth

--------------------
Blessings,
Ray
Go to the top of the page
 
theDBguy
post Apr 13 2020, 03:20 PM
Post#14


UA Moderator
Posts: 78,090
Joined: 19-June 07
From: SunnySandyEggo


Hi Ray. I don't think the names have changed. You may be referring to different properties.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    25th May 2020 - 02:49 AM