Create form with VBA

  • Thread starter Thread starter kristofvdp
  • Start date Start date
K

kristofvdp

Guest
I'm creating my forms and reports with VBA.
But now I have a problem with the Sections.
I can't create a header section for my forms. How can I do this?

Now i'm using the code:

frm1.section(acHeader).height = ....

But access doesn't want to execute because he can't find the section.
Im looking already for 2 days for a solution, maybe you can help me...

thanks
 
Though there may be a way to add a header and footer in code, I'm not aware of it. What I have done is created a template to which I've added the header and footer in design view, and then created my new form from that template.
Syntax for CreateForm line is like...
Code:
Set frmNew = CreateForm(, "frmYourTemplate")
 
thanks thanks thanks

This really works!!!! WIIEEEHAA!!

I was searching a full day long for the answer and i didn't found it. But this works!! Yes, It was very important for me, because me database was depending on it!

You saved my project!!! Many thanks!!!

Greetings,

Kristof
 
Right on! Thanks for expressing your enthusiasm.
Cheers,
Mark
 
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 toggle thier visibility:
.Section(acHeader).Visible = True
.Section(acFooter).Visible = True

Even though this reply is 18 months too late, hopefully it will help someone else.
 

Users who are viewing this thread

Back
Top Bottom