Copy form from one db to another?!

G

Guest

Hi all.

I wish to email updates to an existing db to an office. The updates are in a
new db. When they open the new file it will make a copy the old file and then
send across the updated objects to the old file.

This works fine expect for forms!?

The code below shows how I'm doing this. It work for tables, queries,
reports etc.. but not for forms!

Any help would be welcome.

Thanks

M.


If cntLoop.Name = "Forms" Then
For Each docLoop In cntLoop.Documents
If docLoop.Name <> "frmUpdateDatabaseObjects" Then
DoCmd.CopyObject dbTarget.Name, docLoop.Name, acForm, docLoop.Name
End If
Next docLoop
End If


If cntLoop.Name = "Reports" Then
For Each docLoop In cntLoop.Documents
DoCmd.CopyObject dbTarget.Name, "", acReport, docLoop.Name
Next docLoop
End If


If cntLoop.Name = "Modules" Then
For Each docLoop In cntLoop.Documents
If docLoop.Name <> "Module1" Then
DoCmd.CopyObject dbTarget.Name, "", acModule, docLoop.Name
End If
Next docLoop
End If
 
G

Guest

hi.
When copying to a different database, leave the new name
argument blank to keep the same name.

DoCmd.CopyObject dbTarget.Name, "", acForm, docLoop.Name
 

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