Object invalid or no longer set on CopyObject method



I thought you could use the CopyObject method on anything but modules,
but I continue to get this error when looping though my dbs. I've
tried TransferDatabase and get the same result

Any ideas?

TIA

Here's my code:

Sub copy_forms()

Dim x
Dim dbnames(1 To 9) As String
dbnames(1) = "C:\db1.mdb"
dbnames(2) = "C:\db2.mdb"
dbnames(3) = "C:\db3.mdb"
dbnames(4) = "C:\db4.mdb"
dbnames(5) = "C:\db5.mdb"
dbnames(6) = "C:\db6.mdb"
dbnames(7) = "C:\db7.mdb"
dbnames(8) = "C:\db8.mdb"
dbnames(9) = "C:\db9.mdb"

For Each x In dbnames
DoCmd.CopyObject x, "Main", acForm, "Main"
'DoCmd.TransferDatabase acExport, "Microsoft Access", x, acForm,
"Main", "Main"
Next

Close
MsgBox "Form Copies Complete"

End Sub

.



Relevant Pages

  • RE: Query Custom Form Fields
    ... Dim objItem As MailItem ... saying is you can cut down on your code by looping through the variations on ... > the forms and building an array would seem to be a time/CPU intensive task. ... >> Here's the documentation on the Split function: ...
    (microsoft.public.outlook.program_forms)
  • Re: defining keys and relationships in VBA
    ... Dim dbs As Database, tdf As TableDef ... Dim idx As Index ... > Dim dbs As Database, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Dcount error
    ... Dim strSQL As String ... Dim dbs As Database ... Dim qdf As QueryDef ... Dim qryName As String ...
    (microsoft.public.access.modulesdaovba)
  • RE: ODBC Order by question
    ... "Fysh" wrote: ... Dim dbs As Database ... Dim strSQL As String ... Dim qdfNew As QueryDef ...
    (microsoft.public.access.modulesdaovba)
  • Re: Different BE database uniformity.
    ... Probably refine it to have all the info for all the DBs in TblCurrent with a pointer to which DB they come from. ... BEs are all different Clubs e.g. Sailing Club, Yacht Club, Bridge Club, Family etc. ... Dim dbsExternal As Database ... Dim strSQL As String ...
    (comp.databases.ms-access)