Export MS Access Report to PDF based on condition -


is there way export report in ms access pdf based on criteria/field on report?

i have created productivity report in ms access. instead of exporting 50 pages 1 pdf, there way export based on manager's name? field managers name included on actual report.

you can take idea , play it. insert module

option explicit  dim g_managerreportfilterenabled boolean dim g_managerreportfilter string  public function ismanagerreportfilterenabled() boolean     ismanagerreportfilterenabled = g_managerreportfilterenabled end function  public function getmanagerreportfilter() string     getmanagerreportfilter = g_managerreportfilter end function  public sub exportfilteredmanagerreporttopdf(strmanagername string) on error goto exportfilteredmanagerreporttopdf_errorhandler      g_managerreportfilterenabled = true     g_managerreportfilter = "[mymanagernamefield] = " & chr(34) & strmanagername & chr(34)     docmd.outputto acoutputreport, "myreportname", acformatpdf, "mypath:\myfilename.pdf", false      goto exitme  exportfilteredmanagerreporttopdf_errorhandler:     debug.print err.number & ": " & err.description exitme:     g_managerreportfilterenabled = false     exit sub  end sub 

and review variables need replace. , report_open of report:

private sub report_open(cancel integer)      if ismanagerreportfilterenabled = true         me.filter = getmanagerreportfilter         me.filteron = true     end if  end sub 

so issue code trying solve want use docmd.outputto output our pdf, not take filter parameter. work around setting 2 global variables (i know...) let know if should use manager filter , filter is. when run exportfilteredmanagerreporttopdf , pass through name, sub output report pdf. because of code attached report, when outputto runs, report detect whether filter enabled, , if is, apply it. outputto finishes work , pdf output.

to run manager john smith, say, can run debug window:

 exportfilteredmanagerreporttopdf "john smith" 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -