Adding Time as well as data in Report Page Footer

  • Thread starter Thread starter mark909
  • Start date Start date
M

mark909

=NOW() function returns the current date when you create a report.

How do I set up this function to return the time the report was created as
well as the date?

Thanks for help :)
 
Hi Mark

There are lots of ways
=Date() &" "&Time()

or

="This report was produced on " & Format(Date(),"DDD MMM YYYY") & " at " &
Format(Now(),"h:nn AM/PM")

etc
etc
etc

Hope this helps
 
Thanks Wayne thats great.

For:

=Date() &" "&Time()

How do I get Time() to display if the time is am or pm??
 
Now() returns both date and time. If you're not seeing the time, check that
you're formatting the value appropriately.
 
Simpler method

=Format(Date(),"DD/MM/YY") & " " & Format(Now(),"h:nn AM/PM")

Simpler yet: control source of Now() (which DOES return both date and time);
set the Format property of the report textbox to

"dd/mm/yy hh:nn AM/PM"

or whatever format you find appropriate.
 
Wayne:

I was about to take you to task for not suggesting:

=Format(Now(),"dd/mm/yyyy hh:nn AM/PM)

but by a curious piece of serendipity you've pointed me to a solution to a
little problem I've been mulling over for a few days.

I'm currently helping out a friend in California with an application for a
company there. This includes a couple of combo boxes of date/time values
which they want in the format 'mm/dd/yyyy hh:nn AM/PM', defaulting to the
current date/time. Now, while this is being done for their local office the
company is an international one, which I know trades here in the UK too, so I
can't rule out the possibility of the application being used this side of the
pond. Normally I'd try and format date values using "Short Date", "Long
Date", whatever, so that they are shown in the correct local format, but the
format they want can't be done by formatting the value all in one, but at the
same time automatically adjusting to the local format if used over here.

By formatting the date and time separately, as you suggested, this of course
enables me to use:

' requery date combo box to show dates of
' price lists prepared for selected customer
' and show current date/time as default for new price list
Me.cboDateTime.Requery
Me.cboDateTime = Format(VBA.Date, "Short Date") & Format(VBA.Now, "
hh:nn AM/PM")

Similarly in the query for the control's RowSource property I can return the
date/time values from the table formatted in the same way:

SELECT DISTINCT Format(DateTimePrepared,"Short Date") &
Format(DateTimePrepared," hh:nn AM/PM"), DateTimePrepared
FROM CustomerPricings
WHERE CustomerID = Form!cboCustomer))
ORDER BY DateTimePrepared DESC;

I can see this being useful on many occasions. So, instead of chastising
you I owe you a pint!

BTW, during your current sojourn in foreign parts shouldn't you now be
Wayne-I-T, though I suppose in Italian it should be Wayne-A-T?

Ken Sheridan
Stafford, England
 
I will revert back to being Wayne-I-M on May 1st, then back to Wayne-I-T
again in December.
If I were to be, as you suggest, Wayne-A-T then I would be an "of" and not
an "in".

:-)
 
Back
Top