Detached Event Procedures

N

Neil

I am using Access 2003, and have an ongoing problem of every once in a while
losing an event procedure
for a form or control. The procedure's still in the code module, but the
form or control's property sheet does not show "[Event Procedure]". I have
to manually put it back, and then everything's fine.

Does anyone know what causes this phenomenon, or, at the very least, how to
tell if there are any of these "detached" event procedures? It's extremely
disconcerting to not have a procedure run that you assume is in place simply
because "[Event Procedure]" is missing from the property sheet. Is there a
way to tell if there are any of these in the db?

Thanks!

Neil
 
R

Rick Brandt

Neil said:
I am using Access 2003, and have an ongoing problem of every once in
a while losing an event procedure
for a form or control. The procedure's still in the code module, but
the form or control's property sheet does not show "[Event
Procedure]". I have to manually put it back, and then everything's
fine.
Does anyone know what causes this phenomenon, or, at the very least,
how to tell if there are any of these "detached" event procedures?
It's extremely disconcerting to not have a procedure run that you
assume is in place simply because "[Event Procedure]" is missing from
the property sheet. Is there a way to tell if there are any of these
in the db?
Thanks!

Neil

If you rename the control or cut and paste the control you lose that setting. I
have never encountered anything else that caused it.
 
N

Naeem Azizian

in the on open event,

put something like:

Me.OnTimer = "[Event Procedure]"

this is possible if the on open does not loose it's "[Event
Procedure]". if you want to check that, then you must write a code and
put it in the startup of your database to check and see if all desired
forms have the "[Event Procedure]" in their on open event.


Rick's given you the "when". For how to correct the problem, take a look at
my March, 2004 "Access Answers" column in Pinnacle Publication's "Smart
Access". You can download the column (and sample database) for free athttp://www.accessmvp.com/DJSteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)


I am using Access 2003, and have an ongoing problem of every once in a
while losing an event procedure
for a form or control. The procedure's still in the code module, but the
form or control's property sheet does not show "[Event Procedure]". I have
to manually put it back, and then everything's fine.
Does anyone know what causes this phenomenon, or, at the very least, how
to
tell if there are any of these "detached" event procedures? It's extremely
disconcerting to not have a procedure run that you assume is in place
simply
because "[Event Procedure]" is missing from the property sheet. Is there a
way to tell if there are any of these in the db?

Neil
 
D

Douglas J. Steele

Did you bother checking the reference I gave? It automates the process
you're describing.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Naeem Azizian said:
in the on open event,

put something like:

Me.OnTimer = "[Event Procedure]"

this is possible if the on open does not loose it's "[Event
Procedure]". if you want to check that, then you must write a code and
put it in the startup of your database to check and see if all desired
forms have the "[Event Procedure]" in their on open event.


Rick's given you the "when". For how to correct the problem, take a look
at
my March, 2004 "Access Answers" column in Pinnacle Publication's "Smart
Access". You can download the column (and sample database) for free
athttp://www.accessmvp.com/DJSteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)


I am using Access 2003, and have an ongoing problem of every once in a
while losing an event procedure
for a form or control. The procedure's still in the code module, but
the
form or control's property sheet does not show "[Event Procedure]". I
have
to manually put it back, and then everything's fine.
Does anyone know what causes this phenomenon, or, at the very least,
how
to
tell if there are any of these "detached" event procedures? It's
extremely
disconcerting to not have a procedure run that you assume is in place
simply
because "[Event Procedure]" is missing from the property sheet. Is
there a
way to tell if there are any of these in the db?

Neil
 
N

Neil

The problem with that is that I'd then have to put that code in the on open
event for each form for every form, control, and section event procedure.
That could get in the hundreds, and managing that would be a pain. Thanks,
though.

Naeem Azizian said:
in the on open event,

put something like:

Me.OnTimer = "[Event Procedure]"

this is possible if the on open does not loose it's "[Event
Procedure]". if you want to check that, then you must write a code and
put it in the startup of your database to check and see if all desired
forms have the "[Event Procedure]" in their on open event.


Rick's given you the "when". For how to correct the problem, take a look
at
my March, 2004 "Access Answers" column in Pinnacle Publication's "Smart
Access". You can download the column (and sample database) for free
athttp://www.accessmvp.com/DJSteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)


I am using Access 2003, and have an ongoing problem of every once in a
while losing an event procedure
for a form or control. The procedure's still in the code module, but
the
form or control's property sheet does not show "[Event Procedure]". I
have
to manually put it back, and then everything's fine.
Does anyone know what causes this phenomenon, or, at the very least,
how
to
tell if there are any of these "detached" event procedures? It's
extremely
disconcerting to not have a procedure run that you assume is in place
simply
because "[Event Procedure]" is missing from the property sheet. Is
there a
way to tell if there are any of these in the db?

Neil
 
N

Neil

Great! Thanks! Looks like that will work great.

You know, it would be a lot simpler if Access had an option: Always Use
Existing Event Procedure, such that, if selected, Access will always use the
event procedure if one exists in the code module. For those of use who only
use event procedures, and who experience this problem, it sure would make
things easier! It would also allow us to create the procedure directly in
the module, instead of through the property sheet (I know, we can do that
now, and sometimes the property sheet gets set, but sometimes it doesn't).
It's such a future, ridiculous thing to have to select "Event Procedure" in
the property sheet if you never use macros. At least give us that option,
Microsoft!

(OK, I'm done griping. Thanks again!)


Douglas J. Steele said:
Rick's given you the "when". For how to correct the problem, take a look
at my March, 2004 "Access Answers" column in Pinnacle Publication's "Smart
Access". You can download the column (and sample database) for free at
http://www.accessmvp.com/DJSteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Neil said:
I am using Access 2003, and have an ongoing problem of every once in a
while losing an event procedure
for a form or control. The procedure's still in the code module, but the
form or control's property sheet does not show "[Event Procedure]". I
have
to manually put it back, and then everything's fine.

Does anyone know what causes this phenomenon, or, at the very least, how
to
tell if there are any of these "detached" event procedures? It's
extremely
disconcerting to not have a procedure run that you assume is in place
simply
because "[Event Procedure]" is missing from the property sheet. Is there
a
way to tell if there are any of these in the db?

Thanks!

Neil
 
N

Neil

You might be right. I *seem* to recall it happening randomly, without
cutting and pasting the control. But you might be right. I'll have to keep a
closer eye on it.

Thanks!


Rick Brandt said:
Neil said:
I am using Access 2003, and have an ongoing problem of every once in
a while losing an event procedure
for a form or control. The procedure's still in the code module, but
the form or control's property sheet does not show "[Event
Procedure]". I have to manually put it back, and then everything's
fine.
Does anyone know what causes this phenomenon, or, at the very least,
how to tell if there are any of these "detached" event procedures?
It's extremely disconcerting to not have a procedure run that you
assume is in place simply because "[Event Procedure]" is missing from
the property sheet. Is there a way to tell if there are any of these
in the db?
Thanks!

Neil

If you rename the control or cut and paste the control you lose that
setting. I have never encountered anything else that caused it.
 
T

Tony Toews [MVP]

Neil said:
You know, it would be a lot simpler if Access had an option: Always Use
Existing Event Procedure, such that, if selected, Access will always use the
event procedure if one exists in the code module. For those of use who only
use event procedures, and who experience this problem, it sure would make
things easier! It would also allow us to create the procedure directly in
the module, instead of through the property sheet (I know, we can do that
now, and sometimes the property sheet gets set, but sometimes it doesn't).
It's such a future, ridiculous thing to have to select "Event Procedure" in
the property sheet if you never use macros. At least give us that option,
Microsoft!

I can never remember where this option is so I had to do some Groups Google
searching. So thanks to a posting by Albert Kallal here's part of your gripe
solved.

tools->options->forms/reports tab
[x] - Always use Event procedures.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
N

Neil

Yes, that's a helpful option for not having to select Event Procedure in the
property sheet when you double-click on a control. And perhaps that would
resolve the issue of not being able to create the procedure directly in the
code module. So that would be great. But, as you say, it's only part of the
gripe. I want an option where I don't even have to deal with the property
sheet -- where Access always uses the event procedure if one exists in the
code module, and just manages the property sheet itself (or makes the Event
tab invisible if the option is checked). Damn it, I DEMAND it, Microsoft!
Give me that feature or I'll take my business elsewhere! (OK, now I've got
them scared.....)


Tony Toews said:
Neil said:
You know, it would be a lot simpler if Access had an option: Always Use
Existing Event Procedure, such that, if selected, Access will always use
the
event procedure if one exists in the code module. For those of use who
only
use event procedures, and who experience this problem, it sure would make
things easier! It would also allow us to create the procedure directly in
the module, instead of through the property sheet (I know, we can do that
now, and sometimes the property sheet gets set, but sometimes it doesn't).
It's such a future, ridiculous thing to have to select "Event Procedure"
in
the property sheet if you never use macros. At least give us that option,
Microsoft!

I can never remember where this option is so I had to do some Groups
Google
searching. So thanks to a posting by Albert Kallal here's part of your
gripe
solved.

tools->options->forms/reports tab
[x] - Always use Event procedures.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
T

Tim Marshall

Neil said:
Great! Thanks! Looks like that will work great.

I've downloaded Doug's article but haven't gone over it in detail, yet,
though it sounds very useful.

In my own personal experience I lose procedures exactly as how Rick
described. For me, it's usually when I'm designing a form, and later
run out of real estate and decide to introduce a tab control - moving
existing controls to the tab control (cutting and pasting) always
results in a "lost" procedure.

What I have found easiest to do (again, I haven't gone through Doug's
paper in detail) is, after pasting the controls into the tab control (or
where ever) is to simply open each control's properties and just double
click on the events I know have event procedures with them. The "[Event
Procedure]" appears and the connection to the code in the form's module
is refreshed.
 
D

Douglas J. Steele

My article isn't rocket science, Tim. All I'm doing is going through the
module, looking at all the names of all the Subs and ensuring that those
that correspond to Event Procedures have the appropriate Event property set
to [Event Procedure]. (At least, I think that's all it does: it was quite
some time ago that I wrote it)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Tim Marshall said:
Neil said:
Great! Thanks! Looks like that will work great.

I've downloaded Doug's article but haven't gone over it in detail, yet,
though it sounds very useful.

In my own personal experience I lose procedures exactly as how Rick
described. For me, it's usually when I'm designing a form, and later run
out of real estate and decide to introduce a tab control - moving existing
controls to the tab control (cutting and pasting) always results in a
"lost" procedure.

What I have found easiest to do (again, I haven't gone through Doug's
paper in detail) is, after pasting the controls into the tab control (or
where ever) is to simply open each control's properties and just double
click on the events I know have event procedures with them. The "[Event
Procedure]" appears and the connection to the code in the form's module is
refreshed.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
 
A

Arno R

Tim Marshall said:
What I have found easiest to do (again, I haven't gone through Doug's
paper in detail) is, after pasting the controls into the tab control (or
where ever) is to simply open each control's properties and just double
click on the events I know have event procedures with them. The "[Event
Procedure]" appears and the connection to the code in the form's module
is refreshed.

Even more easy:
Select all the code, Cut and paste (Ctrl-X, Ctrl-V)

Still possible that there is code that is 'not attached' with that approach but that's because the control is not there.
Doug's utility checks for both kinds of errors.

Arno R
 
N

Neil

Yes, double-clicking in the property sheet would be the easiest thing to
do -- if you remember all the events that are defined. I'd be sure to miss
one or two. Probably the best thing to do, if one were to do it manually,
would be to rename the control, make a copy of it, then paste the copy and
rename it to the original name. Then use the original one to get all the
procedures off the property sheet. At least, that's what I'd need to do.
But, as you say, Doug's solution would probably be the way to go.

About this situation in general, I'm relieved to hear that no one else
experiences this. I was really expecting a bunch of people to say, "Oh yeah,
this is a known glitch in Access, and Microsoft has been saying for some
time that they'd fix it." So I'm glad that's the not the case.

When these things started appearing for apparently no reason (since I hadn't
moved any controls), I just assumed it was a glitch. But I have a client who
likes to "play" with the formatting of the forms, and I passed on Rick's
note to him. And he said, "Oh yeah, it was probably me then. I was playing
around with the controls and moving them to different tabs." So the culprit
is found out! :)

Thanks!

Neil


Tim Marshall said:
Neil said:
Great! Thanks! Looks like that will work great.

I've downloaded Doug's article but haven't gone over it in detail, yet,
though it sounds very useful.

In my own personal experience I lose procedures exactly as how Rick
described. For me, it's usually when I'm designing a form, and later run
out of real estate and decide to introduce a tab control - moving existing
controls to the tab control (cutting and pasting) always results in a
"lost" procedure.

What I have found easiest to do (again, I haven't gone through Doug's
paper in detail) is, after pasting the controls into the tab control (or
where ever) is to simply open each control's properties and just double
click on the events I know have event procedures with them. The "[Event
Procedure]" appears and the connection to the code in the form's module is
refreshed.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
 
N

Neil

Yeah, but it's a lot of coding. For those of us who are lazy, you've done us
a big favor! :)

Douglas J. Steele said:
My article isn't rocket science, Tim. All I'm doing is going through the
module, looking at all the names of all the Subs and ensuring that those
that correspond to Event Procedures have the appropriate Event property
set to [Event Procedure]. (At least, I think that's all it does: it was
quite some time ago that I wrote it)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Tim Marshall said:
Neil said:
Great! Thanks! Looks like that will work great.

I've downloaded Doug's article but haven't gone over it in detail, yet,
though it sounds very useful.

In my own personal experience I lose procedures exactly as how Rick
described. For me, it's usually when I'm designing a form, and later run
out of real estate and decide to introduce a tab control - moving
existing controls to the tab control (cutting and pasting) always results
in a "lost" procedure.

What I have found easiest to do (again, I haven't gone through Doug's
paper in detail) is, after pasting the controls into the tab control (or
where ever) is to simply open each control's properties and just double
click on the events I know have event procedures with them. The "[Event
Procedure]" appears and the connection to the code in the form's module
is refreshed.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
 
N

Neil

Really? I've never trusted Access to register the event procedure on the
property sheet. Even when I paste in a procedure, I still go to the property
sheet to double-check. But if you do this and have found it to reliably put
[Event Procedure] in the property sheet, then that's great! Thanks for the
tip!



Tim Marshall said:
What I have found easiest to do (again, I haven't gone through Doug's
paper in detail) is, after pasting the controls into the tab control (or
where ever) is to simply open each control's properties and just double
click on the events I know have event procedures with them. The "[Event
Procedure]" appears and the connection to the code in the form's module
is refreshed.

Even more easy:
Select all the code, Cut and paste (Ctrl-X, Ctrl-V)

Still possible that there is code that is 'not attached' with that approach
but that's because the control is not there.
Doug's utility checks for both kinds of errors.

Arno R
 

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