Mel said:
1 Will deleting a Form delete any code attached to the form?
Well, the answer is "kind of" yes. It is important to realize that each form
is actually what we call a class object. If you write code in a forms
module, and declare a function as public, then that function actually
becomes a "method" of that form. In simple English, each form has a code
module (class module) associated with that form. You do not have to put all
code for a form in the forms module, but I would think that is what most
people do. Note that you can have multiple instances of that form open, and
thus multiple copies of all the variables and code for that form can be
active at the same time. So, yes, if you delete that form, then the
associated class module is deleted.
*HOWEVER* your code in that class module (the forms associated module) can
certainly call code in a standard module. So, often a form will use all
kinds of code from a particular "standard" code module that you create. So,
if you have some data processing routines, or tax calculations modules, that
code does not belong (nor is attached) to a particular form. So, often you
need lot of "general" code that many of your forms can run/use. This
"general" code can thus be called from a forms module, and when you delete
the forms module, then of course the code in those standard modules ARE NOT
deleted.
So, when I say "kind of yes", well, all code in the forms module is deleted,
but that code certainly COULD HAVE been calling, and using code from
standard modules. So, some of that forms code does not actually have to be
placed in a forms module (any code that more then one form needs to share
thus would be placed in a standard code module). So, code in a standard
module is NOT deleted when you delete a form).
2 Is there a way to see all the code associated with an Access data
base?
I assume you looking to do this for documenting of code. To view code all at
the same time, you can't really (and it would be just torture yourself
anyway). If you have 50 forms in a application, why would you want to see
the code for all 50 forms? That is just of no use. You going to have 50
on-load events, and what form is that code attached to while you are viewing
it?
So, I have to assume you need this for documenting purposes. Yes!, you can
printout all code in forms and reports and standard code modules (and you
can select which ones you want). It likely kill a few trees in the process,
but to do this, go
tools->analyse->documenter
From the above, you can select all forms (or repost, or standard code
modules). MAKE SURE you click on the "options" tab to remove certain things
you don't want to print (else you use up 500 packages before you can save a
tree!!).
3 - Or must you open every form and ask for code view? Or what?
In your case use the documenter, and select all forms, and then use the
"option" button to printout ONLY code for those forms (so, do NOT select the
module tab..as that is JUST for standard code modules...not the forms code).
By the way, test and play with the "options" on ONE form until you get the
results you want, and then you do a "select" all...to print all code for all
forms....