• Error Trapping error 2603 (Access 2k)

    Author
    Topic
    #398954

    Dear All

    I’ve set a few forms up so that certain user groups can’t open them, however if code is run to open these forms they are offered the option of ending or debugging the code, not a simple message “No permissions”, or whatever. I’ve got the standard error trapping in the code as attached. So what have I done wrong / missed?

    This is my first foray into Access Security and is causing a few grey hairs (OK it’s the old age responsible for the grey, but I need summat to blame grin ).Private Sub RejFollowUpBtn_Click()
    On Error GoTo ErrHandler

    DoCmd.OpenForm “FollowUpDataEntryFrm”, acNormal

    ExitSub:
    Exit Sub

    ErrHandler:
    If Err.Number = 2603 Then
    MsgBox “You do not have access to this area of the database”, vbOKOnly
    Resume ExitSub
    Else
    MsgBox Err.Description
    Resume ExitSub
    End If

    End Sub

    I’ve tried using a Select Case statement in my error handler, along the lines of: –
    Select Case Err.Number
    Case Err.Numbner = 2603
    msgbox Err.Description
    Resume ExitSub
    Case Else
    etc etc

    While I can change the message on the pop up de###### form, I can’t prevent the thing from offering the user the option to view my code. They are not allowed to edit it, that much works, but it is not as ‘neat and tidy’ as I like to have a system.

    Thanks

    Ian

    Viewing 1 reply thread
    Author
    Replies
    • #766879

      First of all, we usually try to prevent someone from ever getting to the point where they can try to open a form (via code) by hiding buttons and so forth based on UserGroup. That get’s pretty tricky with Switchboard driven systems however, so you probably do need some error handling. First of all, are you sure the error is always 2603? It seems to me I’ve seen others as well that are related to security. Your code looks to be OK from what I can see – but be aware that from 2000 on, the code is not covered by the security scheme. So you may want to look at other methods of protecting your code as well. Once solution is to deploy an MDE version of the code, so you can’t even open the VBA de######. Hope this helps.

      • #766919

        Wendell

        Thank for the info, yes, so far I’ve only had error 2603 when a form is accessed by someone without permissions for it.

        Is there anyway I could check the user group with the code on the button, or on the on open event for the form? Surely if I can do this I can set the buttons visible property?? I’m grasping at straws here with a limited knowledge of the security model.

        Thanks

        Ian

        • #766979

          Yes, there is a way to check for UserGroup, though in 2000 it’s fairly convoluted. It’s simpler in 2002 as there is some native support for lookup of UserGroup. For 2000, the Access Developer’s Handbook has lots of details as to how to do that. You may find it simpler to check for a small number of user names than to try to write lots of code behind multiple forms.

        • #766980

          Yes, there is a way to check for UserGroup, though in 2000 it’s fairly convoluted. It’s simpler in 2002 as there is some native support for lookup of UserGroup. For 2000, the Access Developer’s Handbook has lots of details as to how to do that. You may find it simpler to check for a small number of user names than to try to write lots of code behind multiple forms.

      • #766920

        Wendell

        Thank for the info, yes, so far I’ve only had error 2603 when a form is accessed by someone without permissions for it.

        Is there anyway I could check the user group with the code on the button, or on the on open event for the form? Surely if I can do this I can set the buttons visible property?? I’m grasping at straws here with a limited knowledge of the security model.

        Thanks

        Ian

    • #766880

      First of all, we usually try to prevent someone from ever getting to the point where they can try to open a form (via code) by hiding buttons and so forth based on UserGroup. That get’s pretty tricky with Switchboard driven systems however, so you probably do need some error handling. First of all, are you sure the error is always 2603? It seems to me I’ve seen others as well that are related to security. Your code looks to be OK from what I can see – but be aware that from 2000 on, the code is not covered by the security scheme. So you may want to look at other methods of protecting your code as well. Once solution is to deploy an MDE version of the code, so you can’t even open the VBA de######. Hope this helps.

    Viewing 1 reply thread
    Reply To: Reply #766979 in Error Trapping error 2603 (Access 2k)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel