G'Day All...back from a wicked weekend away and I have an interesting question...

Is there a way of evaluating which Function or Sub the code is currently running.

Let me elaborate. Say I have an error checking Sub which handles the Err object for me but I want to know from which function or sub it was called from. Is there any way of doing that.


Say I have this error checking Sub.
Sub CheckError(whichFunction)
	If Err.Number <> 0 Then
		Session("errormsg") = "<b>Error Code:</b> " & Err.number - vbObjectError & "<br>" _
							& "<b>Error Source:</b> " & Err.source & "<br>" _
							& "<b>Error Description:</b> " & Err.description & "<br>" _
							& "<b>Function:</b> " & whichFunction
		Response.Redirect "admin_error.asp"
	End If
End Sub
how can I automatically call this sub and pass the name of the function it was passed from to it rather than having to call it this way:
Function Foo(x, y, z)
    on error resume next
    strsql = "SELECT * FROM table where date = ##"   'purposefully erroneous code
    myRS.Open strsql, myConn
    CheckError "Foo"
End Function
I would rather just call the CheckError sub and not have to give it the calling function name. That is, it would know that it was called from Function Foo.

Wierd question I know but I was wondering if anyone has done anything like this before.

Cheers and have a great one!