For Each form name

T

Tschuß

Hi all,

I have a database with more than 100 forms (yes, it's a big one)
I must export each one of them in an other database so instead of
write the following linge 100 times, I would like to create a loop
with "For Each.....Next" to read the name of my all forms.
But I don't know the name of the form collection ???

For Each My_Form in ??????????
DoCmd.TransferDatabase acExport, "Microsoft Access", "c:\Access
\ACS_V1.00_DE.mdb", acForm, My_Form.Name, My_Form.Name
Next

Any idea ?
 
T

Tschuß

Hi all,

I have a database with more than 100 forms (yes, it's a big one)
I must export each one of them in an other database so instead of
write the following linge 100 times, I would like to create a loop
with "For Each.....Next" to read the name of my all forms.
But I don't know the name of the form collection ???

For Each My_Form in ??????????
    DoCmd.TransferDatabase acExport, "Microsoft Access", "c:\Access
\ACS_V1.00_DE.mdb", acForm, My_Form.Name, My_Form.Name
Next

Any idea ?

I have found what I'm looking for
For Each My_Form In CurrentProject.AllForms
Tmp = My_Form.Name
Next
 
D

Dirk Goldgar

Tschuß said:
Hi all,

I have a database with more than 100 forms (yes, it's a big one)
I must export each one of them in an other database so instead of
write the following linge 100 times, I would like to create a loop
with "For Each.....Next" to read the name of my all forms.
But I don't know the name of the form collection ???

For Each My_Form in ??????????
DoCmd.TransferDatabase acExport, "Microsoft Access", "c:\Access
\ACS_V1.00_DE.mdb", acForm, My_Form.Name, My_Form.Name
Next

Any idea ?


There are a couple of ways to do this, but assuming you're using Access 2000
or later, here's what I think is the simplest one:

Dim My_Form As AccessObject

For Each My_Form In CurrentProject.AllForms

DoCmd.TransferDatabase acExport, _
"Microsoft Access", _
"c:\Access\ACS_V1.00_DE.mdb", _
acForm, _
My_Form.Name, _
My_Form.Name

Next My_Form
 
A

Albert D. Kallal

You could open up the other database, and simply do an import if you don't
need code.....

the import command does have select all option for given type of object
(reports, forms, etc.)
 

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