easy edit forms

S

susan

Hi.

Is there a possibility in Access 2003 to easily edit a form? In Visual Basic
you can even use a texteditor to edit the forms and modify properties of
objects. This is far more faster and easier than in Access.

Thanks
 
A

Allen Browne

Access is quite different from pure VB, in that the forms exist within the
database (MDB) file, not as separate text files on the drive.

The closest approach to what you ask for might be to export the form as a
text file, using
SaveAsText acForm, "Form1", "C:\MyFolder\Form1.txt"
Then try editing the form, delete it from the database, compact, and ask
Access to import it again:
LoadFromText acForm, "Form1", "C:\MyFolder\Form1.txt"
(You may need to experiment with this: it is undocumented, and version
sensitive.)

Some alternative approaches:
a) Select several objects at once in design view, and change the Properties
for them all at once.

b) Change the properties of the objects in the Toolbox. This sets the
default properties when you create new objects on this form.

c) Set up your MDB so that new forms get the properties you want. See:
Default forms, reports and databases
at:
http://allenbrowne.com/ser-43.html
(This one is *really* good in Access 2007, where new databases automatically
get and use the default forms you set up.)

d) Programmatically manipulate the objects on the form.
This kind of thing:

Function ShowControls(strForm As String)
Dim frm As Form
Dim ctl As Control

DoCmd.OpenForm strForm
Set frm = Forms(strForm)

For Each ctl In frm.Controls
Debug.Print ctl.Name, ctl.ControlType
Next

DoCmd.Close acForm, strForm
End Function
 
A

Albert D. Kallal

For the most part, no you can not.

And, for the most part editing the actual meta text of a form will not help
you a lot anyway.

You can use the un-documented saveastext (and loadFromText) feature to
export a form into a meta text file that represents the form.

(from the debug window type in saveastext (you should get inti-sense
popup)).

You can thus send the object (form, report etc) out to a text file. You can
then edit that text file, save it, and then use the loadfrom text.

This process would be clumsy in practice, and thus this idea is not really
what you looking for, nor is it considered an approach that any developer
would use as a normal course of action.

So you *can* gain access to the text file(s) that represent things like
forms etc, but in actual practice, it not practical to edit forms this way.

For 99% of form editing tasks, you should find the form designer adequate
anyway...
 
L

Larry Linson

susan said:
Is there a possibility in Access 2003 to easily edit a form?

Yes, you can very easily edit an Access Form in Design View.
In Visual Basic you can even use a texteditor to edit the
forms and modify properties of objects. This is far more
faster and easier than in Access.

Tell ya' what... if have an application suitable for Access (database,
individual user, multiuser Access/Jet in a LAN environment, or client
application to a server database in a LAN or WAN environment) and you
arrange a face-off between an accomplished Access developer and an
accomplished VB developer, the Access developer will win, hands-down, every
time. That was the case in the world of "classic VB" (V6 or earlier) and
it's still so in the world of DotNet.

Your view that using a text editor in VB is so much easier may be related to
the fact that VB.NET is much more code-intensive than Access.

Larry Linson
Microsoft Office Access MVP
(and user of VB from V1 through V6)
 
Top