Results 1 to 2 of 2

Thread: [RESOLVED] Can I pass an err as a parameter to a sub?

  1. #1

    Thread Starter
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Resolved [RESOLVED] Can I pass an err as a parameter to a sub?

    I have an app that will be used by two different customer systems. Both have their own error handling routines but they differ from each other.

    What I'd like to do is create a simple sub which recieves an error in and then uses its attributes to call the apropriate error handling for the system. Something like:-
    Code:
    Public Sub pcError(errIn As error)
        Select Case gstrSource
        Case "SystemA"
            Call SystemAErrors(Err.number, err.description, err.source)
        Case "SystemB"
            Call SystemBErrors(Err.Number, err.Source, Err.Description)
        End Select
    End Sub
    The trouble is that when I call this sub passing in err as an object I get a type mismatch. If I change errIn to a long the type mismatch goes away and err default property (number) gets passed in. But then I've lost access to the other attributes.

    I could pass in the attributes individually but that means alot of parms (I've simplified the code above, the error handling routines use most of the err attributes plus a few more bits of info I'll pass in as parms) and it would be far more elegant to pass in the error object if I could.

    Any suggestions?

  2. #2

    Thread Starter
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    Re: Can I pass an err as a parameter to a sub?

    Forget it, I'm being dense. The contents of err will still be there so I don't need to pass it at all. Doh

Posting Permissions

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



Click Here to Expand Forum to Full Width