UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Edit Discussion
> ReportRevisionDate    
(Difference between revisions)
Revision as of 17:24, 12 August 2010
Doctor9 (Talk | contribs)

← Previous diff
Revision as of 17:27, 12 August 2010
Doctor9 (Talk | contribs)

Next diff →
Line 31: Line 31:
4. Open your report in Design View. 4. Open your report in Design View.
-5. Add an unbound textbox to the page footer (or wherever you would like the revision date to appear), and add the following as the textbox's ControlSource:+5. Add an unbound textbox to the page footer (or wherever you would like the revision date to appear), and add the following as the textbox's ControlSource (There is no need to substitute your report's actual name between the square brackets):
'''=ReportRevisionDate([Name])''' '''=ReportRevisionDate([Name])'''
-This will pass the name of the report to the function, which will return that report's ''.DateModified'' property as a Date datatype.+This will pass the name of the report to the function, which will return that report's ''.DateModified'' property as a Date datatype.
6. Format the unbound textbox to display the date as you want it to appear. 6. Format the unbound textbox to display the date as you want it to appear.

Revision as of 17:27, 12 August 2010

This is a set of instructions to show you how to easily include a report's Revision Date on a report.


First, you must create a User-Defined Function that will return a given report's .DateModified property:

1. Create a new code module, and name it "modReportRevisionDate".

2. Add the following code to the code module:

CODE
Public Function ReportRevisionDate(ReportName As String) As Date

'   Code courtesy of UtterAccess Wiki
'   http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary
'   Original submission by Dennis Kuhn (UtterAccess Username: doctor9)
'   August 12, 2010
'
'   This code is not to be altered or distributed,
'   except as part of an application.
'   You are free to use it in any application,
'   provided this copyright notice is left unchanged.

   ReportRevisionDate = CurrentProject.AllReports(ReportName).DateModified

End Function

3. Close and Save the code module.

The function is now ready to use.

4. Open your report in Design View.

5. Add an unbound textbox to the page footer (or wherever you would like the revision date to appear), and add the following as the textbox's ControlSource (There is no need to substitute your report's actual name between the square brackets):

=ReportRevisionDate([Name])

This will pass the name of the report to the function, which will return that report's .DateModified property as a Date datatype.

6. Format the unbound textbox to display the date as you want it to appear.

NOTE: This function will not work on a new, unsaved Report. The report must be saved with a name, so that Access can identify which report to get the revision date for.

Edit Discussion
Thank you for your support!
Disclaimers