Solved

Disable Bypass Key (again)

Posted on 2003-10-22
6
716 Views
Last Modified: 2012-06-27
I have a really great module for disabling the bypass key which I aquired right here at experts exchange.  Its in two parts, part one the module:

Option Compare Database
Option Explicit

Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer

On Error GoTo Err_SetProperties

Dim db As DAO.Database, prp As DAO.Property

        Set db = CurrentDb
            db.Properties(strPropName) = varPropValue
        SetProperties = True
        Set db = Nothing
   
Exit_SetProperties:
Exit Function

Err_SetProperties:
    If Err = 3270 Then 'Property not found
        Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
        db.Properties.Append prp
        Resume Next
    Else
        SetProperties = False
        MsgBox "SetProperties", Err.Number, Err.Description
    Resume Exit_SetProperties
End If
End Function

and part two the command button that fires it:

Private Sub bDisableBypassKey_Click()
On Error GoTo Err_bDisableBypassKey_Click
'This ensures the user is the programmer needing to disable the Bypass Key
Dim strInput As String
Dim strMsg As String
Beep
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & _
"Please key the programmer's password to enable the Bypass Key."
strInput = InputBox(Prompt:=strMsg, title:="Disable Bypass Key Password")
If strInput = "joy" Then
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & _
"The Shift key will allow the users to bypass the startup options the next time the database is opened.", _
vbInformation, "Set Startup Properties"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _
"The Bypass Key was disabled." & vbCrLf & vbLf & _
"The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", _
vbCritical, "Invalid Password"
Exit Sub
End If
Exit_bDisableBypassKey_Click:
Exit Sub
Err_bDisableBypassKey_Click:
MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
Resume Exit_bDisableBypassKey_Click
End Sub

This has worked great for me in the past and I'm attempting to use it in a new database but I get an error when I try to compile on this line in the module
Dim db As DAO.Database, prp As DAO.Property
the error says user define type not defined.

Any idea what the problem is?  
I'm thinking I failed to reference a library but I don't know which one or if thats even close to the answere.

Please Help!
0
Comment
Question by:browsen
  • 3
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
Jeremyw earned 250 total points
ID: 9601524
You need to reference the Microsoft DAO 3.x Object Library.

Jeremy
0
 
LVL 11

Expert Comment

by:BillPowell
ID: 9601598
Jeremy is right, In Access 2000 and above, a DAO reference does not get turned on by default, as it is replaced with ADO.  Setting the reference should fix it.
0
 

Author Comment

by:browsen
ID: 9602354
Thanks A Bunch Jeremy!

I kinda figured it was a missing reference but I would never remembered which one.  Thanks for the help!

PS

Does anyone besides me wish that EE would go back to the "old look"?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 3

Expert Comment

by:Jeremyw
ID: 9602417
Thanks for the ? browsen

"Does anyone besides me wish that EE would go back to the "old look"?"

It will :)  http://oldlook.experts-exchange.com

Jeremy
0
 

Author Comment

by:browsen
ID: 9602735
Well I'll be (insert curse word here)!

Thanks Jeremy I like this view ALOT better!
0
 
LVL 3

Expert Comment

by:Jeremyw
ID: 9606084
No problem.  I've finally gotten used to the new look.  Still like some things about the old way though.

Jeremy
0

Featured Post

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.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server views 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 Access…
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…

820 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