Using the DoCmd Object to Programmatically Add Sections to Reports at Runtime
Private Sub cmdAddHeadersFooters_Click()
'Open rptAny in Design view
DoCmd.OpenReport "rptAny", acViewDesign
'Add a report header and footer
DoCmd.RunCommand acCmdReportHdrFtr
'Add a page header and footer
DoCmd.RunCommand acCmdPageHdrFtr
End Sub