A2002 (sub)form behaviour driving me crazy!!!

  • Thread starter Vladimír Cvajniga
  • Start date
V

Vladimír Cvajniga

Hi,

in A2002 i have a form with a subform that I need to initialize on Form_Open
(I set subform controls' position & visibility & finally subform's width).
In some cases (when I interrupt the code and go to form designer) the
subform saves it's last appearance (and all controls' properties!!!)
according to the initialization procedure. Then I open the form in preview
and all the dynamic stuff is gone since subform's controls' properties are
set incorrectly - they were saved when I interrupted the code and went to
form designer.

I mean I need subform's controls in the same initialiation status always
when I open main form and I'd like to get all controls back in their init
status when I go to design mode. Setting forrm's and subform's property
AllowDesignChanges to FALSE doesn't help. Is there any workaround? Or do I
have to save all my forms in separate MDB so that I have their original
initialization status if this happens?

Sorry for my poor English... I hope you got the idea.

TIA

Vlado
 
S

Stefan Hoffmann

hi,

Vladimír Cvajniga said:
In some cases (when I interrupt the code and go to
form designer) the subform saves it's last appearance (and all controls'
properties!!!) according to the initialization procedure.
Don't save changes while debugging.


mfg
--> stefan <--
 
V

Vladimír Cvajniga

TYVM for your respond, stefan.

What about changes in code modules? And sometimes I may forget that I'm in
debug mode... should I make no changes in debug at all?
 
A

Allen Browne

Stefan is correct: saving in Break mode significantly increases the chance
of corrupting your database.
 
V

Vladimír Cvajniga

Pitty... since I'd expect I would be able to make changes in code (in break
mode) and thus easily repair mistakes. If I may not make any changes in
break mode then I always have to:

1) stop the execution
2) close all open objects
3) go to the code and repair one or two lines
4) save
5) run the project again to check out if it's OK; if not, go to 1)

Why MS has built a program like this? Can't believe it's true... If there
was a possibility to choose from
a) Save project to MDB
b) Save project to text files

I would always set Access to b).

Vlado
 
V

Vladimír Cvajniga

Hmm... and if I stop the execution in break mode and make some changes, will
there be no risk of database corruption?
I'd like to know how MS Access handles program modules... in detail.

Vlado
 
A

Allen Browne

No. You don't have to make all those steps. Just don't change the code while
it is running (i.e. without stopping the code first.)

Access keeps 2 copies of the code:
- the binary version of the form's code (pseudo-compiled);
- the text version (the one you view and edit.)

When you start modifying a form, Access creates a copy (so you can revert if
you don't wish to save.) It is now juggling 4 copies of the code.

If you start editing while the code is in break mode, Access is supposed to
create these copies while the code is executing in break mode, and still
resume the code.

Occassionally it drops the ball in the middle of this juggling act, and the
result is a corrupt form. A decompile will sometimes rescue the form, but
you can avoid the corruption by stopping to the code and switching to design
view before you edit the code.
 
V

Vladimír Cvajniga

This is what all Access developers should know before they start their first
application. TYVM for detailed info, Allen. I've ordered Access 2002
Developer's Handbook but I'm affraid I won't find any Access background
secrets in that book.

I hope that MS will do some research on Access MDB corruption and will
change a few things to make Access safer. In a mean time they could publish
a list of the most dangerous things in Access and some help how to avoid all
potentional problems.

I was lookin forward to A2007 (CZ trial version should be available soon)
but I'm not sure if I really need Access that may destroy my projects. I
tend to switch to Delphi but first I'd like to test some things to see if
it's the right decision.

Thank you very much for your time, Allen. I really appreciate your work
here.

Vlado
 
V

Vladimír Cvajniga

Does this problem correspond with AllowDesignChanges property? I always set
it to False (Design View Only). So that I expect that all controls'
properties will be reset to their original design-view-values when I'm back
in design view.

Is that a bug in A2002?
 

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