Solved

Disable/enable shift key in Access 2003 ADP/ADE

Posted on 2007-11-23
9
4,122 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

770 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