Get all report history : Reports « Access « VBA / Excel / Access / Word






Get all report history

 

Function ReportHistory(sRpt As String) As String
  
  Dim acObj As AccessObject
  Dim sRptIn As String
  Dim sDatePrinted As String
  Dim sDateModified As String
  Dim sDateCreated As String
  Dim sPort As String
  Dim sDevice As String
  Dim sBuild As String
  
  sRptIn = sRpt
  sPort = "Port name: " & Application.Printers(0).Port
  sDevice = "Device name: " & Application.Printers(0).DeviceName
  sBuild = ""
  
  For Each acObj In CurrentProject.AllReports
    With acObj

      If acObj.Name = sRptIn Then
        sDatePrinted = "Date printed: " & Now()
        sDateModified = "Date modified: " & .DateModified
        sDateCreated = "Date created: " & .DateCreated
        Exit For
      End If

    End With
  Next acObj

  sBuild = sDatePrinted & ", " & sPort & ", " & sDevice & ", " & _
           sDateCreated & ", " & sDateModified & "."

  ReportHistory = sBuild

End Function

 








Related examples in the same category

1.Use the report object variable to point at each report in the Reports collection