Time and Date Stamp

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hello.

I am trying to add a time and date stamp to one of my
reports. I thought it would be as easy as just going to
the Insert...Date and Time. When I do this, Access
creates a control on the report with the the control
source as:

=Format(Date(),"Long Date") & " " & Format(Time(),"Long
Time")

However, when I run the report it prompts me to "Enter
Parameter Value" for "Format".

Why is this and what can I do to work around it?

Thanks in advance,

MC
 
Hi,

I think you could ommit Format in ControlSource. Instead of that you may set
Format Property to "Long Time". I'd do the following:

1) add an unbound textbox
2) set ControlSource to =Now()
3) that's it !!!

HTH.

Vlado
 
I actually already did that ( =Now() ) and set the format
to General Date. This way I do get the time and date
stamp in this format: 2/5/2004 9:30 PM But I want it in
the following format: Thursday, February 5, 2004 9:30 PM

It not a big deal, just wanted to see how it would be done.

Thanks,

MC
 
How about this:
=Format(Now(),fncMyDate)

Put this code in a module:
Public Function fncMyDate()
fncMyDate = "dddd, mmmm d, yyyy hh:nn AMPM"
End Function

Enjoy!

Vlado

"Mike C." <[email protected]> píse v diskusním príspevku
I actually already did that ( =Now() ) and set the format
to General Date. This way I do get the time and date
stamp in this format: 2/5/2004 9:30 PM But I want it in
the following format: Thursday, February 5, 2004 9:30 PM

It not a big deal, just wanted to see how it would be done.

Thanks,

MC
 
Mike said:
Hello.

I am trying to add a time and date stamp to one of my
reports. I thought it would be as easy as just going to
the Insert...Date and Time. When I do this, Access
creates a control on the report with the the control
source as:

=Format(Date(),"Long Date") & " " & Format(Time(),"Long
Time")

However, when I run the report it prompts me to "Enter
Parameter Value" for "Format".

Why is this and what can I do to work around it?


What you used looks perfectly legal to me, so I'd worry
about a more serious problem than that expression. It looks
like there's something wrong in your references.

BTW, you can just set the text box's expression to =Now()
and set the text box's Format property to a custom format:

dddd, mmmm d, yyyy hh:nn AMPM

You don't need to use the Format function at all.
 
You don't need to use the Format function at all.

Not true in CZ version of MS Access!!! When I set
=Format(Now();"dddd, mmmm d, yyyy hh:nn AMPM")

and press Enter it automatically changes to
=Format(Now();"dddd"", ""mmmm d"", yyyy ""hh:nn ampm")

Urrrrgh!!! It happens in many other occasions! Any work-around?

Vlado
 
I suggested using the Format property, not the Format
function. When I set enter
dddd, mmmm d, yyyy hh:nn ampm
in the format property, it was changed to
dddd", "mmmm d", "yyyy hh:nn ampm
which is all fine and proper.

OTOH, when I set the control source expression to
=Format(Now();"dddd, mmmm d, yyyy hh:nn AMPM")
it changed it to:
=Format(Now(),"dddd"", ""mmmm d"", ""yyyy hh:nn ampm")
which is also perfectly fine. I'm using US version of AXP
so that might account for the different behavior.

Have you tried using the alternate syntax
=Format(Now(),"dddd\, mmmm d\, yyyy hh:nn ampm")
and what does that get changed to?
--
Marsh
MVP [MS Access]




Vladimír Cvajniga said:
You don't need to use the Format function at all.

Not true in CZ version of MS Access!!! When I set
=Format(Now();"dddd, mmmm d, yyyy hh:nn AMPM")

and press Enter it automatically changes to
=Format(Now();"dddd"", ""mmmm d"", yyyy ""hh:nn ampm")

Urrrrgh!!! It happens in many other occasions! Any work-around?

Vlado
 
Hi, Marsh,

instead of yyyy I must enter rrrr (year = rok in Czech).

=Format(Now(),"dddd\, mmmm d\, rrrr hh:nn ampm")
changes to
=Format(Now();"dddd"", ""mmmm d"", ""rrrr hh:nn ampm")
which is OK.

But when setting format property I must use yyyy!
dddd, mmmm d, yyyy hh:nn ampm
automatically changes to
dddd", "mmmm\ d", "yyyy\ hh:nn\ ampm

Funny, isn't it?

The problem is that this behaviour isn't documented and it's quite
difficult to handle all these strings. I think I'll go and "play games" to
check out all the tricks. The easiest one is to use a UDF - only in that
case I really know what I'm doing. ;-) Using UDF I can omit
the-funny-MS-internationalization.

BTW, I don't use special date formats very often - "Short Date" is a
favourite one. :-)

Thank you for your post - it's quite interesting & very important!

Vlado
Marshall Barton said:
I suggested using the Format property, not the Format
function. When I set enter
dddd, mmmm d, yyyy hh:nn ampm
in the format property, it was changed to
dddd", "mmmm d", "yyyy hh:nn ampm
which is all fine and proper.

OTOH, when I set the control source expression to
=Format(Now();"dddd, mmmm d, yyyy hh:nn AMPM")
it changed it to:
=Format(Now(),"dddd"", ""mmmm d"", ""yyyy hh:nn ampm")
which is also perfectly fine. I'm using US version of AXP
so that might account for the different behavior.

Have you tried using the alternate syntax
=Format(Now(),"dddd\, mmmm d\, yyyy hh:nn ampm")
and what does that get changed to?
 
That really is confusing, I doubt that I could keep all that
%#*$ straight. I definitely will agree that this is
"strange" (to be polite), but funny (humorous), NOT!

FWIW, my sympathies,
 
In such occasions my speach is always sarcastic... so it was more
"crying" than "humor". I'd rather smile! Formatting is not the only thing
that's driving me mad, but it's out "of the bussines" here in the thread.

THX.

Keep well.

Vlado.
Marshall Barton said:
That really is confusing, I doubt that I could keep all that
%#*$ straight. I definitely will agree that this is
"strange" (to be polite), but funny (humorous), NOT!

FWIW, my sympathies,
--
Marsh
MVP [MS Access]


Vladimír Cvajniga said:
Hi, Marsh,

instead of yyyy I must enter rrrr (year = rok in Czech).

=Format(Now(),"dddd\, mmmm d\, rrrr hh:nn ampm")
changes to
=Format(Now();"dddd"", ""mmmm d"", ""rrrr hh:nn ampm")
which is OK.

But when setting format property I must use yyyy!
dddd, mmmm d, yyyy hh:nn ampm
automatically changes to
dddd", "mmmm\ d", "yyyy\ hh:nn\ ampm

Funny, isn't it?

The problem is that this behaviour isn't documented and it's quite
difficult to handle all these strings. I think I'll go and "play games" to
check out all the tricks. The easiest one is to use a UDF - only in that
case I really know what I'm doing. ;-) Using UDF I can omit
the-funny-MS-internationalization.

BTW, I don't use special date formats very often - "Short Date" is a
favourite one. :-)

Thank you for your post - it's quite interesting & very important!

Vlado
 
Back
Top