Solved

Disable/enable shift key in Access 2003 ADP/ADE

Posted on 2007-11-23
9
4,107 Views
Last Modified: 2013-12-05
Much has been written about this subject but I am struggling to find a workable solution for ADP/ADE files.

The perfrect solution would be this one:

http://www.utteraccess.com/forums/showthreaded.php?Cat=&Number=153345&page=1&view=expanded&sb=5&o=&vc=1

However it doesn't work with ADP files. (What it does is remotely set the enable/disable shift key property).

My ideal solution would be where the application looks at the PC name or the user log in name and if it is me (or one of my PCs) allows me to use the shift key.

Or, another good one (to save me remembering) is that if the project is an ADP then it allows the shift key, if it is an ADE file then is doesn't (then I wouldn't need to do anything when I compile and distribute it)

Thanks.
0
Comment
Question by:pauldonson
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 15

Expert Comment

by:cquinn
ID: 20338284
The shift key on startup in an ade doesn't let you get at any code, but does allow you to get at tables and stored procedures directly.  If you haven't set up your security properly on the back end database, it allows a malicious user to create havoc or get at data they shouldn't
0
 
LVL 15

Expert Comment

by:cquinn
ID: 20338293
You can do it in code as well - here is the code we use:


Option Compare Database

Option Explicit
 

Function SetBypassForDeveloper()
 

    ChangeProperty "AllowBypassKey", dbBoolean, True

    

    MsgBox "Time : " & Format(Time(), "hh:mm:ss") & vbCrLf & vbCrLf & "Date : " & Format(Date, "dddd dd mmmm yyyy") & vbCrLf & vbCrLf & "The System ByPass Has Been Set For Developers.", vbOKOnly + vbInformation, "BT LSA System ByPass Allowed."

    

End Function
 

Function SetBypassForOthers()
 

    ChangeProperty "AllowBypassKey", dbBoolean, False

    

End Function
 

Sub SetStartupProperties()

    ChangeProperty "StartupForm", dbText, "Customers"

    ChangeProperty "StartupShowDBWindow", dbBoolean, False

    ChangeProperty "StartupShowStatusBar", dbBoolean, False

    ChangeProperty "AllowBuiltinToolbars", dbBoolean, False

    ChangeProperty "AllowFullMenus", dbBoolean, True

    ChangeProperty "AllowBreakIntoCode", dbBoolean, False

    ChangeProperty "AllowSpecialKeys", dbBoolean, True

    ChangeProperty "AllowBypassKey", dbBoolean, True

    MsgBox "DB Properties Have Been Created..."
 

End Sub
 

Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer

    

    Dim dbs As Database

    Dim prp As Property

    

    Const conPropNotFoundError = 3270
 

    Set dbs = CurrentDb

    

    On Error GoTo Change_Err

    dbs.Properties(strPropName) = varPropValue

    ChangeProperty = True
 

Change_Bye:

    Exit Function
 

Change_Err:

    If Err = conPropNotFoundError Then  ' Property not found.

        Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)

        dbs.Properties.Append prp

        Resume Next

    Else

        ' Unknown error.

        ChangeProperty = False

        Resume Change_Bye

    End If

End Function

Open in new window

0
 
LVL 77

Expert Comment

by:peter57r
ID: 20338374
That's some interesting code cquinn.

I'm assuming it is intended to be run within the application frontend.  So does it require a close and re-open of the frontend to take effect?
 
0
 
LVL 57
ID: 20338441
<<So does it require a close and re-open of the frontend to take effect?>>

  It would or you could run it in a "launcher" app.  I've seen setups where they do this against a secured MDB, passing the username and password so that you cannot run the app without executing it via the launcher app.

JimD.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 77

Expert Comment

by:peter57r
ID: 20338477
Yes - I use an external program to set/unset the shift bypass key.
I was really asking the question to get the answer documented.  I would be quite surprised if it did not require a restart.

0
 
LVL 15

Expert Comment

by:cquinn
ID: 20339200
With the code I posted before, if you log in using a specific username/password, it enables the shift key for the next time the frontend is opened, so it does require a restart
0
 

Author Comment

by:pauldonson
ID: 20339330
Thanks cquinn, I have tried the code but I have the same error I get when I have tried other functions:

All the db variables come up with an error "Variable not defined"

I suspect it will also fail at the "Dim dbs as database" line as it isn't recognising the database type.
0
 
LVL 57
ID: 20339609
<<I suspect it will also fail at the "Dim dbs as database" line as it isn't recognising the database type.>>

  This is a references problem.  From A2000 and up, the default data lib is ADO.  That statement is a DAO construct.

  You'll need to open the DB, then a module in design view, click tools/references and check the Microsoft Data Access Objects lib.  Make sure it's listed before the ADO lib.

  Even with that, if the app uses any ADO, you may have problems.  But try it first anyway.  You may even want to uncheck the ADO references.  Chances are it's all written with DAO anyway.

JimD
0
 

Accepted Solution

by:
pauldonson earned 0 total points
ID: 20849240
Hi, sorry for the delay in my response.

I found this solution which was very easy in the end!

http://support.microsoft.com/kb/826765

Thanks for your suggestions.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now