Access Reports

JPearson

Registered User.
Local time
Today, 03:19
Joined
Dec 23, 2009
Messages
54
I am haveing to create a report from scratch in VBA. Yes I know its not the easiet or effective way to do it but for this task it is what I have to do.

The issue I am having is getting the report header to show so I may access it.

The best I can gather form hours of searching is that this code should make the report header visible.

Reports("IA Completion Report").Section(acHeader).Visible = True

I get the error:

Run-time error '2462':
The section number you entered is invalid.

I have tried numerous combinations of this code with variable and replacing acHeader with 1 and still have the same error.

Now if i create the report and then rightclick and select the report header/footer the code will work fine but I would like to be able to do this from the code.

Help?

Thanks,
Justin
 
You need to add the header and footer section to the report.
This command toggles them on or off in the currently focussed report.

DoCmd.RunCommand acCmdReportHdrFtr

You could test for it being visible first and trap the error to ensure you won't be turning it off.
 
Much thanks!!! I have used this forum quite a bit for information but was unable to located that anywhere!!!!

-JP
 

Users who are viewing this thread

Back
Top Bottom