Capturing Procedure Names in Run-Time Error Messages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Is there a way - object property - which you can query in VBA to get the
name of the procedure that is running when the error occurred. I can see
that you can get the GUID. I want the friendly name if it exists.

Thanks.
 
sisyphus said:
Hi,

Is there a way - object property - which you can query in VBA to get
the name of the procedure that is running when the error occurred. I
can see that you can get the GUID. I want the friendly name if it
exists.

Thanks.

No. You have to pass that to your error handler yourself.
 
sisyphus said:
Hi,

Is there a way - object property - which you can query in VBA to get
the name of the procedure that is running when the error occurred. I
can see that you can get the GUID. I want the friendly name if it
exists.

No, unfortunately. You can hard-code it, or maintain your own call
stack, but there's no way I know of to get it from Access/VBA directly.
 
Rick and Dirk are correct.

Suggestions:
1. Create a generic error handling function, and call it from each
procedure.

2. Consider logging the errors. Users can't tell you exactly what happened
where. There's an example here:
Error Handling in VBA
at:
http://allenbrowne.com/ser-23a.html

3. Get the MZTools utility for VBA from mztools.com. With a mouse-click it
drops into any procedure your customized error handling code, including the
procedure name.

4. Don't use Me.Module.Name to pass the name of your module. It fails in an
MDE.
 

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

Back
Top