Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Posts
    130

    Unanswered: Bypass Shift Enter on DB Open

    Can anyone help me with the code I got from The Access Web? I want to turn off the user's ability to use Shift Enter to go into my db. Not sure how to use this code. Not sure what the parameters are on the function.
    Thanks,
    Winston
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86
    MAKE SURE YOU HAVE A BACKUP OR ANOTHER WAY TO GET INTO YOUR DB

    Create a Module with this code in. and then create a macro called 'AutoExec' and have it run the code 'DisableAutoExec () '

    Function DisableAutoExec()

    SetStartupProperties

    End Function

    Sub SetStartupProperties()
    ChangeProperty "StartupForm", dbText, "frm-splash"
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    ChangeProperty "StartupShowStatusBar", dbBoolean, False
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
    ChangeProperty "AllowFullMenus", dbBoolean, False
    ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    ChangeProperty "AllowSpecialKeys", dbBoolean, False
    ChangeProperty "AllowBypassKey", dbBoolean, False
    Application.CommandBars("Menu Bar").Enabled = False

    End Sub

    Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
    Dim dbs As Database, prp As Property
    Const conPropNotFoundError = 3270

    Set dbs = CurrentDb
    On Error GoTo Change_Err
    dbs.Properties(strPropName) = varPropValue
    ChangeProperty = True

    Change_Bye:
    Exit Function

    Change_Err:
    If err = conPropNotFoundError Then
    Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
    dbs.Properties.Append prp
    Resume Next
    Else

    ChangeProperty = False
    Resume Change_Bye
    End If
    End Function

  3. #3
    Join Date
    Apr 2004
    Posts
    130
    Thanks for your real quick response. Tried it... got a error 13 type mismatch on this line:
    ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    Forgot to say environment was A2K2. Can you advise further? Oh, by the way, is there a method to turn this on for admin's only?
    thanks,
    Winston

  4. #4
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86
    This is for Access 97, should still be similar though, try looking in the help as the property is probably just a slightly different name. As for setting it so Admin users still have access I’m not sure, guess you could add some code that does a check to see who is logging on. Or the code to re-view the database window is.

    DoCmd.SelectObject acTable, , True

  5. #5
    Join Date
    Apr 2004
    Posts
    130
    Works like a charm now. Thanks for you help. Will add routine to my app to turn on and off.
    Winston

  6. #6
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86
    That's great, cheers

Posting Permissions

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