Pivate Sub Question

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

If I had 6 buttons that I deleted off my form, how come the Private Subs did
not get deleted?
and how do I know if there is any more Private Subs that do
nothing................Thanks Bob
 
Bob napisa³(a):
If I had 6 buttons that I deleted off my form, how come the Private Subs did
not get deleted?
and how do I know if there is any more Private Subs that do
nothing................Thanks Bob
Hmm, it is difficult
 
I'm affraid that MS Access can't do that. When you delete a control Access,
fortunatelly, doesn't delete an event procedure. In fact, Private does'n
necessarily to be Private, you can change it to Public. If you open a form
with Public Sub then "the Sub" should be available from anywhere in your
project.

I use to call form's subs from subforms, eg. Me.Parent.btnNewItem_Click. Not
sure if it's OK with Access philosophy... ;-) ... but it works. You must be
careful when you make calls like this to avoid "circular calls".

Vlado
 
.... and even Private Sub should not be automatically deleted. It may be
called from another Private Sub or Private Funtion in the same form.

HTH

Vlado
 
Bob said:
If I had 6 buttons that I deleted off my form, how come the Private
Subs did not get deleted?
and how do I know if there is any more Private Subs that do
nothing................Thanks Bob

You can't necessarily know for sure that they do nothing -- some other
procedure might call them -- but you can easily determine which
procedures in a form's module aren't associated with any control's
events. If you open the module and choose "(General)" in the Object
drop-down box at the top of the module's window, then all the procedures
listed in the "Procedure" box beside it are not associated with a
control. Some of them may be utility procedures that have never have
been associated with any control; those are fine. Others, with names
in the form "ControlName_EventName", are almost certainly orphaned event
procedures.
 

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