Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Turn off Bypass key code problem (2000)

    Hi,
    I'm trying to use the code in this excellent <post#=181926>post 181926</post#> .
    The problem lays that when it runs the following error is displayed:
    Compile Error: User-defined type not defined

    It then highlights the following code (in bold)

    Public Sub SetAllowBypass(bAllowBypass As Boolean)
    On Error GoTo Err_Handler

    'bAllowBypass = True - allows Shift Bypass Key
    'bAllowBypass = False - prevents Shift Bypass Key

    Dim strMsg As String
    Dim strPropName As String
    Dim db As DAO.Database
    Dim prop As DAO.Property
    Set db = CurrentDb
    strPropName = "AllowBypassKey"
    db.Properties(strPropName) = bAllowBypass

    Exit_Sub:
    Set db = Nothing
    Exit Sub
    Err_Handler:
    If Err = 3270 Then 'Property not found - create and append
    Set prop = db.CreateProperty(strPropName, dbBoolean, bAllowBypass)
    db.Properties.Append prop
    Resume
    Else
    strMsg = "Error No " & Err.Number & ": " & Err.Description
    Beep
    MsgBox strMsg, vbExclamation, "SET ALLOW BYPASS ERROR"
    End If

    End Sub

    Any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Turn off Bypass key code problem (2000)

    As MarkD mentioned near the end of his post, you must set a reference to the DAO library.

    Select Tools | References... in the Visual Basic Editor.
    Locate and tick the reference to the Microsoft DAO 3.6 Object Library.
    Click OK.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Turn off Bypass key code problem (2000)

    Simple, thanks Hans.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •