Problem with code disappering

G

Guest

I’m currently designing a database which has got quite a bit of code in it.
Recently, something happened that made the code stop working. It was all
still in the VB Editor but for some reason it had disappeared from the
property sheets of some of the controls. To make it work again I had to go
into the property sheet of the controls, click on the event procedures tab
and then click on each of the event procedures where the code was and then
click “Event Procedure†from the drop down list. Can anyone tell me why this
happened and if there is a quick way of restoring all of it in one go rather
than having to go through each property sheet to do it.
 
A

Allen Browne

Can't tell you why it occurs, but a quick fix is to open the VBA window,
select all code (Ctrl+A), cut (Ctrl+X), and paste (Ctrl+V.)

That should set the appropriate properties to [Event Procedure] again.

One thing I would suggest is making sure you have unchecked the Compile On
Demand option under Tools | Options (in the code window.)
 
T

tina

Allen, after reading the VBA Help topic, am i understanding correctly that,
as long as the code was compiled before the db was distributed, it will run
faster *without* compile on demand being turned on? does that option have
any effect on mde's? also, is the option setting database specific? or
machine-specific? i'm wondering if i'd need to add code to my databases to
turn the option off/on when a user opens/closes a db. tia, tina


Allen Browne said:
Can't tell you why it occurs, but a quick fix is to open the VBA window,
select all code (Ctrl+A), cut (Ctrl+X), and paste (Ctrl+V.)

That should set the appropriate properties to [Event Procedure] again.

One thing I would suggest is making sure you have unchecked the Compile On
Demand option under Tools | Options (in the code window.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

pompeyjim said:
I'm currently designing a database which has got quite a bit of code in
it.
Recently, something happened that made the code stop working. It was all
still in the VB Editor but for some reason it had disappeared from the
property sheets of some of the controls. To make it work again I had to go
into the property sheet of the controls, click on the event procedures tab
and then click on each of the event procedures where the code was and then
click "Event Procedure" from the drop down list. Can anyone tell me why
this
happened and if there is a quick way of restoring all of it in one go
rather
than having to go through each property sheet to do it.
 
A

Allen Browne

Hi Tina.

The code must be compiled to execute. I think the help topic is merely
saying that if the code is compiled already, it performs faster since Access
does not have to compile it (since it's already compiled.) The code is
compiled if Compile on the Debug menu is greyed out. You can also test
IsCompiled. (Although Access treats that as a yes/no, michka reports that
are actually about 11 different states of compilation.)

The MDE contains *only* the compiled code (not the text version of the
code), and cannot decompile. Therefore, I would not expect the Compile On
Demand setting to make any difference at all in an MDE: it's guaranteed to
be compiled.

Off-hand, I can't tell you if the setting is user-specific. But that makes
no real difference, since you use MDEs for your front end, and they don't
decompile.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

tina said:
Allen, after reading the VBA Help topic, am i understanding correctly
that,
as long as the code was compiled before the db was distributed, it will
run
faster *without* compile on demand being turned on? does that option have
any effect on mde's? also, is the option setting database specific? or
machine-specific? i'm wondering if i'd need to add code to my databases to
turn the option off/on when a user opens/closes a db. tia, tina


Allen Browne said:
Can't tell you why it occurs, but a quick fix is to open the VBA window,
select all code (Ctrl+A), cut (Ctrl+X), and paste (Ctrl+V.)

That should set the appropriate properties to [Event Procedure] again.

One thing I would suggest is making sure you have unchecked the Compile
On
Demand option under Tools | Options (in the code window.)

pompeyjim said:
I'm currently designing a database which has got quite a bit of code in
it.
Recently, something happened that made the code stop working. It was
all
still in the VB Editor but for some reason it had disappeared from the
property sheets of some of the controls. To make it work again I had to go
into the property sheet of the controls, click on the event procedures tab
and then click on each of the event procedures where the code was and then
click "Event Procedure" from the drop down list. Can anyone tell me why
this
happened and if there is a quick way of restoring all of it in one go
rather
than having to go through each property sheet to do it.
 
T

tina

makes sense, thanks! :)


Allen Browne said:
Hi Tina.

The code must be compiled to execute. I think the help topic is merely
saying that if the code is compiled already, it performs faster since Access
does not have to compile it (since it's already compiled.) The code is
compiled if Compile on the Debug menu is greyed out. You can also test
IsCompiled. (Although Access treats that as a yes/no, michka reports that
are actually about 11 different states of compilation.)

The MDE contains *only* the compiled code (not the text version of the
code), and cannot decompile. Therefore, I would not expect the Compile On
Demand setting to make any difference at all in an MDE: it's guaranteed to
be compiled.

Off-hand, I can't tell you if the setting is user-specific. But that makes
no real difference, since you use MDEs for your front end, and they don't
decompile.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

tina said:
Allen, after reading the VBA Help topic, am i understanding correctly
that,
as long as the code was compiled before the db was distributed, it will
run
faster *without* compile on demand being turned on? does that option have
any effect on mde's? also, is the option setting database specific? or
machine-specific? i'm wondering if i'd need to add code to my databases to
turn the option off/on when a user opens/closes a db. tia, tina


Allen Browne said:
Can't tell you why it occurs, but a quick fix is to open the VBA window,
select all code (Ctrl+A), cut (Ctrl+X), and paste (Ctrl+V.)

That should set the appropriate properties to [Event Procedure] again.

One thing I would suggest is making sure you have unchecked the Compile
On
Demand option under Tools | Options (in the code window.)

I'm currently designing a database which has got quite a bit of code in
it.
Recently, something happened that made the code stop working. It was
all
still in the VB Editor but for some reason it had disappeared from the
property sheets of some of the controls. To make it work again I had
to
go
into the property sheet of the controls, click on the event
procedures
tab
and then click on each of the event procedures where the code was and then
click "Event Procedure" from the drop down list. Can anyone tell me why
this
happened and if there is a quick way of restoring all of it in one go
rather
than having to go through each property sheet to do it.
 

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