forms as VBA

P

pvp

I assume that forms and reports in Access are stored not as images but as
VBA code although that is not made visible to the programmer. If that is
true, IS there a way I could edit a form (or report) in its VBA incarnation?

One reason for this question is that I want to globally change the name of
some forms' controls in that form and in VBA modules and subs and
functions all in one operation.

Many thanks.
 
R

RipperT

Yes, simply select your form in the database window,
select View | Code and it will open in VB.

Rip
 
D

Dirk Goldgar

pvp said:
I assume that forms and reports in Access are stored not as images
but as VBA code although that is not made visible to the programmer.
If that is true, IS there a way I could edit a form (or report) in
its VBA incarnation?

One reason for this question is that I want to globally change the
name of some forms' controls in that form and in VBA modules and subs
and
functions all in one operation.

Many thanks.

I don't think forms are stored as VBA code, as such. They are complex
objects, though, not just images. It is possible to use the
undocumented method SaveAsText to save a form's definition as a text
file, and the companion method LoadFromText to create a form object from
such a text file. These are methods of the Access Application object.

I don't know, though, whether you can safely save a form as text, make
substantial changes to that file, and then load it back into a form
again. I don't know that you can't, either. I've used this method to
fix a few errors in report objects (not forms, AFAIR) that were
down-converted from Access 2002 to Access 97; I deleted some properties
that were not supported by Access 97 but were nevertheless not removed
in the downgrade.

When I've had to do the sort of thing you're talking about, though, I
just wrote code to go through all the forms in the database and make the
changes. There are utility programs that make global changes such as
you describe, programs such as SpeedFerret and FindAndReplace, but I've
never gotten around to trying them out.
 

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