Putting date in Report Header

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to put the date in the header of a couple of my reports. The only
catch is that I need the date that is added to be dependent on the time of
day the report is generated. For example, if the report is generated before
8AM it should have today's date. After 8AM it should have tomorrow's date.
I have tried the following code, but it always gives me tomorrow's date:
=IIf(Time()>"8:00:00 AM",Date(),Date()+1)

This is probably an easy fix, but I guess I am overlooking it.

Thanks in advance.
 
Put this into the onload event of your report:


If Time() > "8:00:00AM" Then
Me.Caption = Date + 1
Else
Me.Caption = Date
End If
 
Set these properties for your text box:
ControlSource: =DateAdd("h", 16, Now())
Format: Short Date
 
I'm sorry, that code will actually change the caption of the report, so if
you export to PDF the filename will be the caption.

For your purposes, you can do much the same thing, except instead of
me.caption just refer to the control on the report you want to change.
 
Back
Top