export all reports

  • Thread starter samotek via AccessMonster.com
  • Start date
S

samotek via AccessMonster.com

My function for exporting all reports is not working.Would yo help me find
the reason ?

Private Function ExportAllReports()
Dim Rpt As AccessObject

For Each Rpt In CurrentProject.AllReports
DoCmd.TransferDatabase acExport, "Microsoft Access", StrSurvey, acReport, Rpt.
Name, Rpt.Name
Next Rpt
End Function
 
S

samotek via AccessMonster.com

Alex said:
Do you get an error or what? try to step through the code
My function for exporting all reports is not working.Would yo help me find
the reason ?
[quoted text clipped - 8 lines]
Next Rpt
End Function
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
 
A

Alex Dybenko

Well, difficult to say, if reports can be opened - then is should work.
try to export report to excel manually - will it give you an error? also try
to use docmd.outputto

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

samotek via AccessMonster.com said:
Alex said:
Do you get an error or what? try to step through the code
My function for exporting all reports is not working.Would yo help me
find
the reason ?
[quoted text clipped - 8 lines]
Next Rpt
End Function
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
 

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