0
votes

What I am about to ask is, I hope simple knowledge question.

The command 'CreateReport' in MS Access VBA creates a blank report draft. However, there are only page header and page footer. What I would like to achive is to create blank report draft which includes also report header and report footer. I could add them manualy after I create normal report draft, but then this is not what I want.

Is there any way to do it ?

Thank you all in advance.

2

2 Answers

1
votes

This works:

Sub TestReportCreate()

    Dim rpt As Access.Report

    Set rpt = Application.CreateReport
    ' report is created minimized
    DoCmd.Restore
    ' toggle Header/Footer ON
    Application.RunCommand acCmdReportHdrFtr

    ' Do something with the header
    rpt.Section(acHeader).BackColor = RGB(255, 192, 192)

End Sub

but using the ReportTemplate parameter may be easier.

0
votes

I have found a way out. What I did is I have created blank report with manualy added report header and footer, and used as a draft.