Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Disable Bypass Key (again)

Posted on 2003-10-22
6
Medium Priority
?
737 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
[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
6 Comments
 
LVL 3

Accepted Solution

by:
Jeremyw earned 1000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

670 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