Results 1 to 6 of 6
  1. #1
    Phil-N is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2016
    Location
    Palmerston North, New Zealand
    Posts
    1

    Application Title in Text Box of Report Header


    Hi, I have several Databases that use the same reports. At this stage I have to manually change the title of each report to identify which site it is for, but wondered is it possible to have the "Application Title " (or filename) in say a text box? I have looked through the Expression Builder, but can't seem to find either filename or Application Title. I started using Access over 20 years ago and do it all through queries and properties, I have not used VBA or other coding.

  2. #2
    burt1215 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    34
    If you want to use VBA, here's how I would do it.
    Code:
    Application.CurrentProject.Name
    This will result in the filename as a string with the .extension.
    If you don't want the .extension, you could use something like this:
    Code:
    Dim strFileName As String
    Dim intWhereIsThePeriod As Integer
    Dim strFileNameWithoutExtension As String
    
    
    strFileName = Application.CurrentProject.Name
    intWhereIsThePeriod = InStr(strFileName, ".")
    strFileNameWithoutExtension = Left(strFileName, intWhereIsThePeriod - 1)
    The variable names are a little ridiculous, but it's to give you an idea of what they do.
    From there, I would add this and trigger it to the loading of your report.
    Code:
    Me.txtReportHeader = strFileNameWithoutExtension
    Where txtReportHeader is the name of the text box you want to fill with the name of your file.

    If you have any questions about how you would implement this, let me know and I'll see if I can help out.

  3. #3
    raphaelbm is offline Novice
    Windows 10 Access 2021
    Join Date
    Aug 2025
    Location
    Reading UK
    Posts
    2

    Use [CurrentProject].[Name]

    You asked about "Application Title " (or filename) in say a text box...
    I use the filename all the time to identify which database.


    I make a Name field in the Property sheet calling it:
    f-Project-Name-and-Version
    where the Control Source is:
    =Left([CurrentProject].[Name],InStrRev([CurrentProject].[Name],".")

    That gives me filename up to the .extent part. I can then use it where I want...

    Here is an example using it as a page footer: (With date and page numbers)
    =Format(Date(),"ddd dd-mmm-yyyy") & "@" & [f-Project-Name-and-Version] & " Page " & [Page] & " of " & [Pages]

    Hope that helps...
    raphaelbm

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,555
    Quote Originally Posted by raphaelbm View Post
    You asked about "Application Title " (or filename) in say a text box...
    I use the filename all the time to identify which database.


    I make a Name field in the Property sheet calling it:
    f-Project-Name-and-Version
    where the Control Source is:
    =Left([CurrentProject].[Name],InStrRev([CurrentProject].[Name],".")

    That gives me filename up to the .extent part. I can then use it where I want...

    Here is an example using it as a page footer: (With date and page numbers)
    =Format(Date(),"ddd dd-mmm-yyyy") & "@" & [f-Project-Name-and-Version] & " Page " & [Page] & " of " & [Pages]

    Hope that helps...
    raphaelbm
    Nine year old thread?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Quote Originally Posted by Welshgasman View Post
    Nine year old thread?
    Hate when that happens.

    Was gonna post a simple
    Code:
    x =  oFSO.GetBaseName(CurrentProject.Path) ' returns the filename without extension.
    oFSO is a global self healing instance of FileSystemObject.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    raphaelbm, filename and application title and project name can all be completely different from each other.

    From the Immediate Window:

    ?CurrentDb.Name
    C:\Users\Administrator\June\LL\UmpiresVer2.accdb

    ?CurrentProject.FullName
    C:\Users\Administrator\June\LL\UmpiresVer2.accdb

    ?CurrentProject.Name
    UmpiresVer2.accdb

    ?CurrentDb.Properties("AppTitle")
    UmpiresData

    ?Application.VBE.VBProjects(1).Name
    Umpires
    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.

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

Similar Threads

  1. Null parameter text in report title
    By Beeblebrox in forum Reports
    Replies: 3
    Last Post: 06-19-2016, 11:10 AM
  2. Replies: 1
    Last Post: 06-15-2016, 08:45 AM
  3. Replies: 10
    Last Post: 02-02-2015, 12:03 AM
  4. Replies: 7
    Last Post: 02-23-2014, 06:06 PM
  5. Populate Text in Report Header
    By libraccess in forum Programming
    Replies: 10
    Last Post: 06-28-2013, 11:49 PM

Tags for this Thread

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