Solved

Disable Bypass Key (again)

Posted on 2003-10-22
6
706 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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