Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2009
    Posts
    223

    Unanswered: Same Header and Footer on every Form?

    Hi,

    I have created many Forms in my database.

    Now I would like the same Header (with logo) and Footer (navigation buttons) to be on every Form.

    Is there a simple way to do this, or do I need to change them individually !!!

    Thanks for any help.

    Paul
    Last edited by reddevil1; 05-30-11 at 12:33.

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I've seen this done before with with Subform Controls. You simply set then in place where the Headers/Footers would normally appear, for each form.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Nov 2009
    Posts
    223
    Missinglinq,

    Thanks for your reply. That is a good suggestion about using a subform in the header/footer. It would be useful if there were any site-wide changes too, in the future?

    Now I need to change the height/width, background etc etc of all my previously designed headers/footers.

    Is there any easy way (eg. copy and paste) to change the design of all my headers/footers in one easy step? Or would I have to change each one individually?

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    With a little knowledge of the Access objects model you can use VBA procedures to manipulate the reports in your project, create controls into them, etc. Here's a short example:
    Code:
    Sub ProcessReports()
    
        Dim obj As AccessObject
        Dim rpt As Access.Report
        Dim lbl As Label
        
        For Each obj In Application.CurrentProject.AllReports   ' Enumerate all reports in the current project.
            DoCmd.OpenReport obj.Name, acViewDesign             ' Open report in design view.
            Set rpt = Application.Reports(obj.Name)             ' Get a pointer to the open report.
            rpt.SECTION(acPageHeader).Height = 1440             ' one inch (1440 twips) page header height.
            '
            ' Create a label in the page header section and assign some properties to it.
            '
            Set lbl = CreateReportControl(rpt.Name, acLabel, acPageHeader, , , 144, 144, 5760, 720)
            lbl.Caption = "This is a title"
            lbl.FontName = "Courier"
            lbl.FontSize = 24
            lbl.FontUnderline = True
            lbl.FontBold = True
            '
            DoCmd.Close acReport, rpt.Name, acSaveYes           ' Save the report while closing it.
        Next obj
        
    End Sub
    Have a nice day!

  5. #5
    Join Date
    Nov 2009
    Posts
    223
    sinndho,

    thanks for your reply.

    it all looks good stuff, but probably a little bit too advanced for me. or maybe i am trying to do advanced stuff but dont; realise it

    if i was able to insert the code(s) you suggested, does that mean i can just type the code once and all my previously designed Forms will adjust automatically? or would i have to change each Form separately?

    cheers

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    As the operating code is inside a loop that enumerates all Report objects in the current application, all there reports would be affected and the code should be used only once.

    As you noticed, this technique falls in the "Advanced Access" category but it's not really difficult to understand and to use (that's how Wizards and other Assistants are made).

    Shortly, Access is represented by the Application objet (the root). This object has Properties, Functions (they are called Methods in object-oriended programming) and collections of other objects (Tables, Forms, Reports, etc.). In every of these collections are other objects that also have Properties, Methods and Collection(s). E.g. A Form or a Report has a collection of Controls (Labels, Text Boxes, etc.).

    Everything is explained detail in Access help: search for instance for "AllReports", "Reports" collection, "Controls" collection, "CreateReportControl" method, etc.
    Have a nice day!

  7. #7
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by reddevil1 View Post
    Hi,

    I have created many Forms in my database.

    Now I would like the same Header (with logo) and Footer (navigation buttons) to be on every Form.

    Is there a simple way to do this, or do I need to change them individually !!!

    Thanks for any help.

    Paul
    Here is a great example of how to use a sub form for navigation buttons.

    Nav Buttons


    About the logo:
    I would call code in the form's on load event to log the logo image into the form's header. This way the image is not stored in the form which can cause huge database bloating. I place the code in a standard code module so that it can be shared between all forms..
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  8. #8
    Join Date
    Nov 2009
    Posts
    223
    sinddho,

    thanks again for your veryd etailed reply.

    i obviously need to get my head around things and so will try to absorb the details - wish me good luck - haha.

    cheers

  9. #9
    Join Date
    Nov 2009
    Posts
    223
    hitechcoach,

    thanks for your reply and link.

    will the logo cause database bloating if there is just one logo stored in the database, although it may be called upon many times via the one subform it is connected to?

    cheers

  10. #10
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by reddevil1 View Post
    hitechcoach,

    thanks for your reply and link.

    will the logo cause database bloating if there is just one logo stored in the database, although it may be called upon many times via the one subform it is connected to?

    cheers
    I do not store images in a database because of all the bloat. I would recommend that you monitor the size of the database before and after inserting the image to see what happens.

    Note: Sub forms add a lot of weight/overhead to a form. I would probably not use a sub form just for a logo.


    Cheers
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •