I have an Access 2007 report with a custom header section named SSNHeader. The SSNHeader has preset labels, textboxes, and a chart in it. I want to dynamically add labels and textboxes to the SSNHeader depending on input from a form. I'm using the following code to create the first textbox. But the control is always written to the Detail section. The SSNHeader is not recognized for some reason. I need the control to be placed in the SSNHeader section.
DoCmd.OpenReport "Hidden_Paycheckv2", acViewDesign
' *** Dynamically create report controls ***
Dim txt401k As Control
Set txt401k = CreateReportControl("hidden_paycheckv2", acTextBox, SSNHeader, "", ER_401k, 200, 11000, 5000, 300)