For Each form name

  • Thread starter Thread starter Tschuß
  • Start date Start date
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 ?
 
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
 
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
 
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.)
 
Back
Top