strSurvey is a constant, but i will replace it below with the path. The function below exports all the objects except the reports. This happened recently.I used it so many times but it is only now that i have these sudden problems. Because, if i use this function it in a separate database, then it works. But i cannot explain myself why this function is not working properly in my original database?
Private Function ExportAllObjects()
Dim frm As AccessObject
Dim Rpt As AccessObject
Dim mcr As AccessObject
Dim Mdl As AccessObject
For Each frm In CurrentProject.AllForms
If Not frm.Name = "frmUpsize" Then ' do not export the form "frmUpsize"
DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\BE\MGP\Survey\Survey.mdb", acForm, frm.Name, frm.Name
End If
Next frm
For Each Rpt In CurrentProject.AllReports
DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\BE\MGP\Survey\Survey.mdb", acReport, Rpt.Name, Rpt.Name
Next Rpt
For Each mcr In CurrentProject.AllMacros
If Not mcr.Name = "AutoexecUpsize" Then
DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\BE\MGP\Survey\Survey.mdb", acMacro, mcr.Name, mcr.Name
End If
Next mcr
For Each Mdl In CurrentProject.AllModules
DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\BE\MGP\Survey\Survey.mdb", acModule, Mdl.Name, Mdl.Name
Next Mdl
End Function