Solved

Disable/enable shift key in Access 2003 ADP/ADE

Posted on 2007-11-23
9
4,138 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

685 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