?
Solved

Disable/enable shift key in Access 2003 ADP/ADE

Posted on 2007-11-23
9
Medium Priority
?
4,152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…
Suggested Courses

762 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