Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export all reports

Status
Not open for further replies.

samotek

Technical User
May 9, 2005
197
BG
My function for exporting all reports is not working.Would yo help me find the reason ?

Private Function ExportAllObjects()
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
 
You do not show a value for strSurvey, is there one?

If not, what error are you getting?
 
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
 
Can you export a report manually? What happens if you use a single test line:

DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\BE\MGP\Survey\Survey.mdb", acReport, "rptThisReport", "rptThisReport"

Does your code compile? Are your references ok? Does
?acReport
In the immediate window return a value?
 
And, again, WHICH ERROR ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top