Results 1 to 2 of 2
  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.

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