DoCmd.CopyObject for acform doesn't work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GWR
    New Member
    • Sep 2007
    • 1

    DoCmd.CopyObject for acform doesn't work

    I have been tring to copy forms from the current db my code is in to an new mdb I have created in the same subroutine. I closed the new mdb file so it shows being there and when I run the code I get back a message that the form "Main" already exits in the open database. The command I am running looks like the following:
    DoCmd.CopyObjec t LFilename,,acFo rm,"Main"

    This form exists in the current mdb file but not in the new one I created. This statement will work if I rename the form like this:
    DoCmd.CopyObjec t LFilename,"Main 1",acForm,"Main "

    I don't want to do that since the code will not work then because form names are used in the code. Everything I have found says to leave the [New name] blank to use the same name as the source object. This code works for acTable and acQuery but I can't get it to work for acForm. Any help would be appreciated. Thanks
Working...