?
Solved

Disable/enable shift key in Access 2003 ADP/ADE

Posted on 2007-11-23
9
Medium Priority
?
4,175 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

840 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