I just ran across this thread today. The solution on how to create the header/footer in code is simple. Make sure the Form is in DESIGN view, and then:
DoCmd.RunCommand acCmdFormHdrFtr
This command is the same as using the VIEW menu to turn these sections on.
Then, you can use VBA to...