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!

Creating the Header Section of an Access Form programatically

Status
Not open for further replies.

ccgdba

Programmer
Jan 20, 2008
1
US
I am building Access Forms dynamically and when using CreateForm() it creates a new form with just the Detail section of the form, no header or footer sections. When trying to access the header or footer sections using

Forms!Form1.Section(acHeader)

I get Runtime Error 2462.

If I go into Design View and use the User Interface to create the header and footer the above code works fine.

I am trying to figure out what method(s) is being called by the user interface to create the header and footer sections

 
First I believe you must create a control on the header and then you can use:

Forms!Form1.Section(acFormHeader).Visible = True

remember that you have form headers, page headers, and group headers. So, acFormHeader or acPageHeader would be what you would need. Plus the toggle normally for the header in the design view is to go to the menu and toggle it on or off.


Bob Larson
A2K,A2K3,A2K7,SQL Server 2000/2005,Crystal Reports 10/XI,VB6, WinXP, and Vista
Free Quick Tutorials and Samples:
 
ccgdba,
Your getting the error because the Header section does not exist. Try this:
Code:
DoCmd.RunCommand acCmdFormHdrFtr

boblarson,
The machine I'm on is running Office 2k SP2 and there is no [tt]acFormHeader[/tt] constant, only [tt]acHeader[/tt] and any attempt to manipulate this section without toggling it on via the View menu (or the above code) results in the same error ccgdba received. Which version of Access are you using?

CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top