Access MVP (2010-2015)

oOo.oOo.oOo.oOo.oOo.oOo

Add your Report Name to Page Footer…

Put the TEXT box on the Report and in the Control Source put…

=[Name]

OR to get the Report Name and the Date/Time

=[Name] & "  Printed on " & Now()

OR to get the Report Name and the Date

=[Name] & "  Printed on " & Date()

…now if you change the Name of the Report you don’t have to worry about updating a LABEL, it will do it for you.

Courtesy of Bob Larson, Access MVP (2008, 2009 & 2011)

In addition, you can also add the RecordSource of your Report…
(This only works if you use a Naming Convention!)

='(Based on ' & IIf(Left([RecordSource],3)="tbl","Table","Query") & ':  "' & [RecordSource] & '")'

And another way that takes more then just Tables and Queries into account…

Function ObjectType(Source As String) As String
'Courtesy of Hans V Access MVP  from http://www.eileenslounge.com/
'Posted in Microsoft Answers on 8.9.2013 http://answers.microsoft.com/en-us/office/forum/office_2010-access/any-code-to-reference-source-of-report-ie-query/be4a9d5a-cf0f-4f0e-9b8b-01c89b26f70c
     
    Dim varType As Variant</strong>
 
    varType = DLookup("Type", "MSysObjects", "Name='" & Source & "'")
    
    If IsNull(varType) Then
        ObjectType = "Error!"
    Else
        Select Case varType
            Case 1, 4, 6
                ObjectType = "Table"
            Case 5
                ObjectType = "Query"
            Case Else
                ObjectType = "Other"
        End Select
    End If
End Function

 1,233 total views,  4 views today

Comments are closed.