Getting the Function Name

K

Ken

Is there a way to get the current function name?

I see how to get the form name that is executing but I would like to have
the name of the function that is running in the status bar. I know I can put
it there explicitly but I was hoping there was a dynamic way to do this so I
could just copy the syscmd function into the start of the function.

Thanks.
 
K

Klatuu

Yes MzTools is a great tool. You can have the error handler tell you what
procedure the error occured in, but not out of the box. You have to
configure MzTools to do it.

Once you have it installed, open the VBA editor and on the MzTools menu bar,
select the Tool Box button. You will get an options dialog. Select the
Error Handler tab and set the error handler procedures to your liking. Here
is an example of how mine is set up:

On Error GoTo {PROCEDURE_NAME}_Error

{PROCEDURE_BODY}

{PROCEDURE_NAME}_Exit:
On Error GoTo 0

Exit {PROCEDURE_TYPE}

{PROCEDURE_NAME}_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure {PROCEDURE_NAME} of {MODULE_TYPE} {MODULE_NAME}"
GoTo {PROCEDURE_NAME}_Exit

It produces this code for the error handler:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure DelCurrentRec of Module modFormOperations"
GoTo DelCurrentRec_Exit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top