I am having some trouble copying an object (specifically a form) from one mdb file to another using VBA code. Here is a brief description of the Access error I am getting:
I have a couple lines of VBA code to copy some forms, tables, reports and queries from one database object to another. The following is a snippet of the code I am using I am using
(note: path is a variant representing the path to the new database)
'Forms
DoCmd.CopyObject path, "frmAdd", acForm, "frmAdd"
DoCmd.CopyObject path, "frmSSAResults", acForm, "frmSSAResults"
DoCmd.CopyObject path, "sfrPrevious", acForm, "sfrPrevious"
'querries
DoCmd.CopyObject path, "qryFIPSCat", acQuery, "qryFIPSCat"
DoCmd.CopyObject path, "FIPSQuestionnaire", acQuery, "FIPSQuestionnaire"
'reports
DoCmd.CopyObject path, "rptFIPSCat", acReport, "rptFIPSCat"
'tables
DoCmd.CopyObject path, "tblVersionNumber", acTable, "tblVersionNumber"
DoCmd.CopyObject path, "tblListOfSystems", acTable, "tblListOfSystems"
When I execute the code with the path as a blank database it works fine. When I use the file that I currently wish to put these objects in I get some errors for the forms only. It works fine if I comment out the lines regarding the copying of forms. I have seen the following error messages:
Error number Description
3011 The Microsoft Jet database engine could not find the object ‘DigSig’. Make sure the object exists and that you spell its name and the path name correctly.
3011 The Microsoft Jet database engine could not find the object ‘Attributes’. Make sure the object exists and that you spell its name and the path name correctly.
2102 The form name ‘|’ is misspelled or refers to a form that doesn’t exist.