How can I display the Date Created and Date Modified in a report (similar to Name and RecordSource)?
How can I display the Date Created and Date Modified in a report (similar to Name and RecordSource)?
The Date Created and the Date Modified of what? Are these fields in table?
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.
The report itself (similar to Name and RecordSource).
If you want a field on the report, it should be in the recordsource of that report.
Typically the report's recordsource is a table or query.
see this M$oft link for more info.
Name and RecordSource are properties of the report object. Why would you want the report object date created and date modified?
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.
On a report, one can insert a text box that is "=[Name]" or one that is "=[RecordSource]". Both are standard in reports I create. What I am asking is whether there is a similar way to insert a text box that shows when the report was created or last modified.
If you are talking about the report design, I think the MySysObjects table has this information. Can reveal system tables by right click on the Navigation pane bar > Navigation Options > Show System Objects. Could use DLookup() expression to pull the date values.
If you are talking about when data that is being reported was originally input and when it was last edited, that is very different
Last edited by June7; 11-28-2014 at 01:14 PM.
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.
GID,
You can have a preliminary form with a dialog, and use the responses to add parameters to code to generate/publish a report.
See Martin Green's material on Dynamic Reports.
From the report, I tried this function passing along the Report Name, but I cannot get DLookup to find the right report. (Of course, since the same object could have the same name, I'd also have to limit the TYPE to -32764.)
Function ReportLastUpdated(nam)
ReportLastUpdated = DLookup("[DateUpdate]", "MsysObjects", "[NAME] = nam")
End Function
I meant to say "since more than one object could have the same name, I'd also have to limit the TYPE to -32764.)"
Use as many criteria in the DLookup filter argument as you want.
Don't put variables within quote marks. Concatenate variables.
"[Name]='" & nam & "' AND [Type]=-32764"
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.
THANKS! I wouldn't have thought to use 'single quotes'.
The final result that works:
Function ReportLastUpdated(nam)
ReportLastUpdated = DLookup("[DateUpdate]", "MsysObjects", "[Name]='" & nam & "' AND [Type]=-32764")
End Function
Text fields require apostrophe delimiters for parameters, date/time use #, nothing for numbers.
I still don't understand why the date a report object was last modified is of value. This date has nothing to do with editing data.
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.
Thanks for your interest, but I do have a use for it as I maneuver through hundreds of reports in a database that was started in 1987 (before Access) to restructure reports that Access won't let me update more than 255 times.
If one uses a report to create other reports -- and those to create even more -- eventually none of them can be updated when the magic 255 counter is reached. Heaven knows what some programmer years ago was thinking, but one has to ask, "Who is served by that?"
BTW, I found this out the hard way when I programmed at a Federal Government agency years ago.
255 counter for what? A report cannot be edited more that 255 times? I am not aware of such a limit.
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.