Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    156

    Unanswered: Security/Permission Error Trapping

    Hello all!

    As I sit here fat and happy from Turkey Day celebrations and food (and now the leftovers. . . . ), I'm needing some help.

    Does anyone know how to trap the errors that are generated when you try to open up a form/report based on a table for which you do not have permissions?

    Further, does anyone have any suggestions on the best way to look at a user's permissions when opening anything and performing an action based on those permissions? My first question is the most pressing. Thanks in advance!
    DocX

    The teachings of God's Begotten: 2 John 1:9

  2. #2
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    A quick way to find out is to try to open the table from code and pass the error number to a messagebox (im not really familiar with this particular error)
    Then in your code you could do something like this

    Code:
    Sub TrapOpenTableError()
        
        On Error Resume Next
        DoCmd.OpenTable "DavesTable"
        'Check the Value of the Error Number
        Select Case Err.Number
        Case 0
            'Table opens Normally
            MsgBox "All Ok"
        Case 7874
            'Handle case when object doesn't Exsist
            MsgBox "Object Doesn't Exsist"
        Case Else
            'for every other Error
            MsgBox Err.Number & " " & Err.Description
        End Select
        On Error GoTo 0
    End Sub
    Dave

  3. #3
    Join Date
    Jul 2004
    Posts
    156
    You're suggesting that when I open the bound form, try to open the table first (as with maybe ADO) and see if it gives me an error that way? That's possible. Seems like a lot of extra handling though and maybe some overhead.

    I wish I could just account for that error if it happens. For example, I have it check when opening a bound form if there are any records. If not, it cancels the opening and gives an error for the DoCmd.OpenForm and I can trap that. However, this is an Access error--not Jet. There has to be a Jet error that's trappable in this case.

    Anyone have any suggestions?
    DocX

    The teachings of God's Begotten: 2 John 1:9

  4. #4
    Join Date
    Jul 2004
    Posts
    156
    Still fishing for an answer.
    DocX

    The teachings of God's Begotten: 2 John 1:9

Posting Permissions

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