Results 1 to 11 of 11
  1. #1
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    Populate Text in Report Header


    I've trawled the net for something on this. Can anyone think about how to Put a header title in a module that would be used to "write" a name to reports. I've seen where a result from a query can be used but I am wanting to prevent the user from manipulating (changing) the title.
    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Sure; create a public function that returns the title and put a textbox in the header with:

    =FunctionName()
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    Could you throw me another crumb please I can get message box to throw up a result but cannot find anything on returning a text value
    (glum)

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Might help if you posted what you're trying, but does this help?

    http://www.baldyweb.com/Function.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    I have done a module modRptsTitle

    I had looked at your page and Googliarised a hundred other, another hour of my life gone

    Public Function RptsTitle() As String
    RptsTitle "Green Acres"
    End Function
    this is one of a few things I've tried but seeing as it does not return a value the next part won't work

    in the text box on the reports the Control Source is =RptsTitle()

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    I do not understand what you want. If title is not a static label or textbox bound to field, where should it come from?

    The function doesn't return anything because there is no = sign. That code shouldn't even compile.

    RptsTitle = "Green Acres"

    Why use a function that returns literal text that could simply be a label caption?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    Hi
    Should have given the whole story. About 15 reports. I want the company name in the header. So I can put the Company Name ( actually it is for sports clubs so club name) into labels but every time I supply to a different Company (or Club) that is a lot of Copy Paste when one line of code could do the job. Sorry I missed the = sign when typing here. This brings up a parameter Query RptsTitle when any report is opened

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Can you post the db here?

    just noticed your location. Visited my daughter who lives in Wellington around Easter. We tried to visit Napier but there was no room at the inn.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    So you are developing a db product for distribution to independent clubs? You will be modifying the code before giving it to user? A better approach might be a table, even if it has only one record and one field, to hold the club name. Then if you want a function, it can lookup value from the table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    I don't know whether I'm more embarrassed about living in a town with one inn or whether I've just spotted my report control source as =RptsTiltle()

    So where on the list of "if things don't work recheck your speiilng" lies. Probably Number One
    Oh well it has probably given you a chuckle

    Thankyou for letting me waste your time

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    LOL! Lots of inns I'm sure, we were trying to put together a last minute trip. Ended up in wine country, but we stupid Americans didn't realize how big Easter Friday is in NZ.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Text box in header
    By Ray67 in forum Reports
    Replies: 5
    Last Post: 12-05-2012, 08:30 PM
  2. Replies: 2
    Last Post: 06-15-2012, 07:32 AM
  3. Replies: 2
    Last Post: 06-11-2012, 09:37 AM
  4. importing header and body information from text (csv) file
    By JamesL in forum Import/Export Data
    Replies: 6
    Last Post: 04-10-2012, 09:47 PM
  5. report header
    By nashr1928 in forum Reports
    Replies: 2
    Last Post: 07-13-2010, 12:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums