Solved

Disable Bypass Key (again)

Posted on 2003-10-22
6
683 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now