Q: Any way to export a form's design as some kind of editable sourcefile?

M

MKR

Is there any way I can export a form's design as some kind of editable,
re-importable source file? I looked for it in Access (2002 & 2003) but
could not find it.

What I want to do is to be able to enforce certain visual design rules
about the geometry & layout of form elements. Currently I create and
tweak forms manually on a GUI. As I tweak a form by adding or changing
existing elements, it's difficult to ensure that the tweaked version
still adhere to the design rules.

Right now I'm thinking that there may not be a built-in solution for
doing that. However, a VBA-based export/import solution should be
feasible, at least in principle.

If you know of tricks and/or free export/import implementations, please
share your ideas.

Thanks.
 
J

John Nurick

The undocumented Application.SaveAsText method will create an
undocumented text file containing the details of a form or other object,
and the equally undocumented Application.LoadFromText will import such a
file and reconstruct the form.
 
M

MKR

John said:
The undocumented Application.SaveAsText method will create an
undocumented text file containing the details of a form or other object,
and the equally undocumented Application.LoadFromText will import such a
file and reconstruct the form.

Thanks.

You must be right about the SaveAsText method being undocumented. I just
looked for it in object explorer but couldn't find it. Could you tell me
what parameters (with types) the two methods take?
 
J

John Nurick

You must be right about the SaveAsText method being undocumented. I just
looked for it in object explorer but couldn't find it. Could you tell me
what parameters (with types) the two methods take?

They're not in the Object Browser, but if you type
Application.SaveAsText<space>
in a module or the Immediate Pane, Intellisense should recognise it. The
arguments for both are ObjectType As acObjectType and strings for the
object name and filespec.

Searching the web or the newsgroup archives should find some information
or speculation; but remember that "undocumented" includes
"unsupported"<g>.
 
D

Douglas J. Steele

Sorry to argue, John, but both SaveAsText and LoadFromText are in the Object
Browser. RIght-click on the Object Browser, and choose "Show Hidden Members"

See my February, 2005 "Access Answers" column in Pinnacle Publication's
"Smart Access" for a discussion of these methods, including screen shots of
them in the Object Browser. You can download the column (and sample
database) for free at http://www.accessmvp.com/DJSteele/SmartAccess.html
 
J

John Vinson

You must be right about the SaveAsText method being undocumented. I just
looked for it in object explorer but couldn't find it. Could you tell me
what parameters (with types) the two methods take?

They'll display with Intellisense when you type the expression. FWIW,
it's

Application.SaveAsText(ObjectType AS acObjectType, ObjectName As
String, FileName As String)

LoadFromText is identical in its parameters. For example:

Application.SaveAsText(acForm,"frmMyForm","H:\ClientX\frmMyForm.txt")


John W. Vinson[MVP]
 
M

MKR

John said:
They're not in the Object Browser, but if you type
Application.SaveAsText<space>
in a module or the Immediate Pane, Intellisense should recognise it. The
arguments for both are ObjectType As acObjectType and strings for the
object name and filespec.

Thanks again.
Searching the web or the newsgroup archives should find some information
or speculation; but remember that "undocumented" includes
"unsupported"<g>.

Being undocumented and unsupported is not a big problem here. The export
and import functions are used only in the design process but not in the
database produced.
 
J

John Nurick

Sorry to argue, John, but both SaveAsText and LoadFromText are in the Object
Browser. RIght-click on the Object Browser, and choose "Show Hidden Members"

See my February, 2005 "Access Answers" column in Pinnacle Publication's
"Smart Access" for a discussion of these methods, including screen shots of
them in the Object Browser. You can download the column (and sample
database) for free at http://www.accessmvp.com/DJSteele/SmartAccess.html

One lives and learns! <g>
 
Top