Exporting a form design with code to another .mdb 
Author Message
 Exporting a form design with code to another .mdb


Quote:
> Is there a way to export a form designed in one .mdb to
> another .mdb?  I tried the export feature but the form is
> exported as a .cls module with all the VBA code but the
> form design itself is not accessible...

In code you could use DoCmd.TransferDatabase -- see the help file for
details.  Via the user interface, you'd select the form in the
database window, click menu items File -> Export..., and select the
database you want to export it into.  It works fine for me.  What did
you do that resulted in a .cls module?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



Tue, 03 May 2005 03:15:07 GMT  
 Exporting a form design with code to another .mdb
Is there a way to export a form designed in one .mdb to
another .mdb?  I tried the export feature but the form is
exported as a .cls module with all the vba code but the
form design itself is not accessible...


Tue, 03 May 2005 00:45:11 GMT  
 Exporting a form design with code to another .mdb
I have two copies of the same database on my computer.  
One is a working "user copy" which all users access during
the day and add data to.  The other is a "Mod copy" which
I use to make refinements or improvements to code, forms
or tables.  When I'm done, I import the current tables
from the "User copy" and then overwrite the "working copy"
with the modified one so users can now take advantage of
the changes.

In order to only copy over a form that I either improved
or added, I tried to export the form rather than the
rigmarole involved with of importing tables and then
overwriting the "user" database.  From the VB code window
I select the form from the Project explorer pane and
use "export file" option to save the form to disk as
a .cls type then import the saved .cls module into
the "User Copy" databse.  This brings over the code but
not the form and if a form with the same name already
exists, that form is rendered inaccessible!

What I was wondering is how would one export only a form
and it's code to another database so it's useable in it's
entirety?

Quote:
>-----Original Message-----


>> Is there a way to export a form designed in one .mdb to
>> another .mdb?  I tried the export feature but the form
is
>> exported as a .cls module with all the vba code but the
>> form design itself is not accessible...

>In code you could use DoCmd.TransferDatabase -- see the
help file for
>details.  Via the user interface, you'd select the form
in the
>database window, click menu items File -> Export..., and
select the
>database you want to export it into.  It works fine for
me.  What did
>you do that resulted in a .cls module?

>--
>Dirk Goldgar, MS Access MVP
>www.datagnostics.com

>(please reply to the newsgroup)

>.



Tue, 03 May 2005 06:24:11 GMT  
 Exporting a form design with code to another .mdb

Quote:
> In order to only copy over a form that I either improved
> or added, I tried to export the form rather than the
> rigmarole involved with of importing tables and then
> overwriting the "user" database.  From the VB code window
> I select the form from the Project explorer pane and
> use "export file" option to save the form to disk as
> a .cls type then import the saved .cls module into
> the "User Copy" databse.  This brings over the code but
> not the form and if a form with the same name already
> exists, that form is rendered inaccessible!

That's not the right way to do it. The VB Project Explorer only knows
about code modules.  The forms listed there are class objects, and can
only be exported as class modules from the VB window, because that's
all VB interface knows about them (and you'll notice that only forms
with code modules show up there -- "lightweight" forms aren't seen
because they have no associated class modules).  When you export the
form's class module from the VB window, what you get is a .cls file
that is the text definition of the class.  There are none of the
form's controls and properties, because they aren't part of the class.
Think of it this way:  the form's class module is one of many things
that belong to the form.  The module doesn't contain the form;  the
form contains the module.  If you export the module, that's all you
get -- not the form and all the other things it owns.

Quote:
> What I was wondering is how would one export only a form
> and it's code to another database so it's useable in it's
> entirety?

Either export it directly to the other database from the Access
application window, *not* the VB window, as I described before, or ...

Open the other database and (in the application window) import the
form from the database containing the modified version, or ...

Use the undocumented Application.SaveAsText method to save the
definition of the form and all its objects including the module to a
text file, and then go to the target database and use the undocumented
Application.LoadFromText method to load the form from the text file.
But it's much simpler to just export the form in the normal manner
supported by the user interface.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Quote:

> >-----Original Message-----


> >> Is there a way to export a form designed in one .mdb to
> >> another .mdb?  I tried the export feature but the form
> is
> >> exported as a .cls module with all the vba code but the
> >> form design itself is not accessible...

> >In code you could use DoCmd.TransferDatabase -- see the
> help file for
> >details.  Via the user interface, you'd select the form
> in the
> >database window, click menu items File -> Export..., and
> select the
> >database you want to export it into.  It works fine for
> me.  What did
> >you do that resulted in a .cls module?

> >--
> >Dirk Goldgar, MS Access MVP
> >www.datagnostics.com

> >(please reply to the newsgroup)

> >.



Tue, 03 May 2005 06:48:13 GMT  
 Exporting a form design with code to another .mdb
I'll try out your recommendations and see if I can get it
right this time around.

Thanks very much for all your help.  

Des.

Quote:
>-----Original Message-----


>> In order to only copy over a form that I either improved
>> or added, I tried to export the form rather than the
>> rigmarole involved with of importing tables and then
>> overwriting the "user" database.  From the VB code
window
>> I select the form from the Project explorer pane and
>> use "export file" option to save the form to disk as
>> a .cls type then import the saved .cls module into
>> the "User Copy" databse.  This brings over the code but
>> not the form and if a form with the same name already
>> exists, that form is rendered inaccessible!

>That's not the right way to do it. The VB Project
Explorer only knows
>about code modules.  The forms listed there are class
objects, and can
>only be exported as class modules from the VB window,
because that's
>all VB interface knows about them (and you'll notice that
only forms
>with code modules show up there -- "lightweight" forms
aren't seen
>because they have no associated class modules).  When you
export the
>form's class module from the VB window, what you get is
a .cls file
>that is the text definition of the class.  There are none
of the
>form's controls and properties, because they aren't part
of the class.
>Think of it this way:  the form's class module is one of
many things
>that belong to the form.  The module doesn't contain the
form;  the
>form contains the module.  If you export the module,
that's all you
>get -- not the form and all the other things it owns.

>> What I was wondering is how would one export only a form
>> and it's code to another database so it's useable in
it's
>> entirety?

>Either export it directly to the other database from the
Access
>application window, *not* the VB window, as I described
before, or ...

>Open the other database and (in the application window)
import the
>form from the database containing the modified version,
or ...

>Use the undocumented Application.SaveAsText method to
save the
>definition of the form and all its objects including the
module to a
>text file, and then go to the target database and use the
undocumented
>Application.LoadFromText method to load the form from the
text file.
>But it's much simpler to just export the form in the
normal manner
>supported by the user interface.

>--
>Dirk Goldgar, MS Access MVP
>www.datagnostics.com

>(please reply to the newsgroup)

>> >-----Original Message-----

message

>> >> Is there a way to export a form designed in one .mdb
to
>> >> another .mdb?  I tried the export feature but the
form
>> is
>> >> exported as a .cls module with all the vba code but
the
>> >> form design itself is not accessible...

>> >In code you could use DoCmd.TransferDatabase -- see the
>> help file for
>> >details.  Via the user interface, you'd select the form
>> in the
>> >database window, click menu items File -> Export...,
and
>> select the
>> >database you want to export it into.  It works fine for
>> me.  What did
>> >you do that resulted in a .cls module?

>> >--
>> >Dirk Goldgar, MS Access MVP
>> >www.datagnostics.com

>> >(please reply to the newsgroup)

>> >.

>.



Tue, 03 May 2005 07:59:30 GMT  
 Exporting a form design with code to another .mdb

says...

[snip]

Quote:

> Use the undocumented Application.SaveAsText method to save the
> definition of the form and all its objects including the module to a
> text file, and then go to the target database and use the undocumented
> Application.LoadFromText method to load the form from the text file.
> But it's much simpler to just export the form in the normal manner
> supported by the user interface.

Dirk, using this SaveAsText method, will this allow me to export Access
forms in a way that I can then open them for designing in Visual Basic?
This would be useful for upgrading Access apps to stand-alone vb apps,
which I've thought about now and then but never investigated.

spark

Quote:

> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com

> (please reply to the newsgroup)



Sat, 07 May 2005 02:30:54 GMT  
 Exporting a form design with code to another .mdb

Quote:

> says...

> [snip]

> > Use the undocumented Application.SaveAsText method to save the
> > definition of the form and all its objects including the module to
a
> > text file, and then go to the target database and use the
undocumented
> > Application.LoadFromText method to load the form from the text
file.
> > But it's much simpler to just export the form in the normal manner
> > supported by the user interface.

> Dirk, using this SaveAsText method, will this allow me to export
Access
> forms in a way that I can then open them for designing in Visual
Basic?
> This would be useful for upgrading Access apps to stand-alone vb
apps,
> which I've thought about now and then but never investigated.

I don't believe so;  at least, not unless you write quite a
sophisticated program to interpret the text file and create the
closest equivalent in VB.  There are programs out there, I believe,
that purport to convert Access applications to VB, but I gather that
they do an imperfect job at best.  You have to bear in mind that
Access forms and controls have many features that simply don't exist
in VB.  I suppose that, if for some reason I wanted to convert an
Access app to VB, I might start with one of those conversion programs
to save myself time.  I can't imagine wanting to do such a conversion,
though.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



Sun, 08 May 2005 00:41:28 GMT  
 Exporting a form design with code to another .mdb

says...

Quote:



> > says...

> > [snip]

> > > Use the undocumented Application.SaveAsText method to save the
> > > definition of the form and all its objects including the module to
> a
> > > text file, and then go to the target database and use the
> undocumented
> > > Application.LoadFromText method to load the form from the text
> file.
> > > But it's much simpler to just export the form in the normal manner
> > > supported by the user interface.

> > Dirk, using this SaveAsText method, will this allow me to export
> Access
> > forms in a way that I can then open them for designing in Visual
> Basic?
> > This would be useful for upgrading Access apps to stand-alone vb
> apps,
> > which I've thought about now and then but never investigated.

> I don't believe so;  

[snip]

Thanks Dirk.



Sun, 08 May 2005 04:38:07 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Form Designer code / form design window not synched on FlexGrid control

2. Export data from mdb to a new mdb with ADO

3. Code for Categories button in Contact design form?

4. Can't open VB.NET form in design view (only get code view)

5. Export forms and code

6. ACC97 mdb to mdb form Import

7. custom form control: Cannot view design view of forms that inherit this form

8. Designing application without indexes, MDB/ADO

9. * Application Design Without Indexes MDB/ADO

10. * Application Design Without Indexes MDB/ADO

11. How to export the report without the design tab

12. Exporting .mdb file by FTP

 

 
Powered by phpBB® Forum Software