473,395 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Generically reference the current control

RLN
I have this error message format I use for my error handling in all
modules, both in vba code inside of a form and vba code that is outside
of forms:

MsgBox Err.Number & "-" & Err.Description, vbOKOnly, cstPgmName & "-" &
cstError
(where the "cst*" fields are constants referencing the program name and
Error title)

When I use the above line, I would like to also include in the titlebar
of the message the current vba module name where the message came from
and/or the current control being used.

Is there a way to do this?

Thanks.

Sep 11 '06 #1
2 3587
RLN wrote:
I have this error message format I use for my error handling in all
modules, both in vba code inside of a form and vba code that is
outside of forms:

MsgBox Err.Number & "-" & Err.Description, vbOKOnly, cstPgmName & "-"
& cstError
(where the "cst*" fields are constants referencing the program name
and Error title)

When I use the above line, I would like to also include in the
titlebar of the message the current vba module name where the message
came from and/or the current control being used.

Is there a way to do this?
The current control perhaps with screen.activecontrol, but there will be
times when popups will cause that to be incorrect. The module and routine
are not retrievable. You'll need to supply those manually.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Sep 11 '06 #2
I would recommend you get an add-in called MZ-Tools. It does lots of cool
things in the vba editor, and one of the coolest is that it lets you write
error handler templates that include the procedure name and module name, and
it inserts these easily into your procedures. I think it's even free or
shareware.
-John

"RLN" <rl***************@yahoo.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>I have this error message format I use for my error handling in all
modules, both in vba code inside of a form and vba code that is outside
of forms:

MsgBox Err.Number & "-" & Err.Description, vbOKOnly, cstPgmName & "-" &
cstError
(where the "cst*" fields are constants referencing the program name and
Error title)

When I use the above line, I would like to also include in the titlebar
of the message the current vba module name where the message came from
and/or the current control being used.

Is there a way to do this?

Thanks.

Sep 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pkpatel | last post by:
Hi, I keep getting this error every time I try to load crystalreportviewer on a webform with a dataset. Here is the error: -------------------------------------------------------- Server...
0
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
5
by: Alphonse Giambrone | last post by:
How can I reference a page or user control's properties (such as viewstate) and controls from another class? TIA -- Alphonse Giambrone Email: a-giam at customdatasolutions dot us
6
by: blash | last post by:
Can someone help me? I really don't have a clue. My company staff told me they often got such error: "Object reference not set to an instance of an object." when they are in search result page...
3
by: Brano | last post by:
HI all, I have a problem i have a web application that was working fine and this morning when i run it and click on a button that does Reponse.Redirect to a page i get this error : Server...
1
by: Mark Hoffy | last post by:
Hello, I have an MDI app. There are many child forms and they all have several things in common. They all have a Save button, a public variable boolNavigate, and they all have a TreeView...
1
by: Nathan Sokalski | last post by:
I have a UserControl that I declare programmatically as follows: Dim userctrl as New rightside_portal() The codebehind file for this UserControl looks like the following: Partial Public...
2
by: sravan_reddy001 | last post by:
I created a tabcontrol toolin my application.(actually i am creating a tabbed browser) when the user clicks on the newtab button(provided by me) the new tab is added and the webbrowser control...
0
by: Tamer Ibrahim | last post by:
Hi, Sometimes, I got the following error message when I use ajax calendar control on some aspx pages : Object reference not set to an instance of an object. Description: An unhandled exception...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.