Date _and_ time in same box?

  • Thread starter StargateFanFromWork
  • Start date
S

StargateFanFromWork

At the top of the entry form for the contacts example database, there is
this line of code in a box:

=IIf(IsNull([lastname]),"",[firstname] & " " & [lastname] & ", " &
[Birthdate])

That got me to thinking how nice it would be to put in the FOOTER of a
REPORT the date and time rather than having one box for the date with =NOW()
and one for the time with =NOW() each formatted to show either date/time.
That might not be the right way to do this, but that's what this newbie
figured out some time back and that's what she uses <g>.

Seeing how that code above uses "" and &, etc., to put different codes into
one box, can we do the same time of thing for the date and time so that it
all comes out naturally even on one line with correct spacing between date
and time? (Currently, esp. since I haven't figured out how to slide in
Access yet, there's a big space sometimes between date and time depending on
the length of a month's name and they're sometimes a bit uneven until I
adjust the field boxes in the properties. All would be properly taken care
of if date/time in one field box.)

Thanks!
 
J

Joan Wild

=Now() does give you both the date and time; it's just how you've formatted
it that suppresses display of one or the other.

Change the format of the textbox to General Date or define a custom format,
and you'll be set.
 
S

StargateFanFromWork

Joan Wild said:
=Now() does give you both the date and time; it's just how you've formatted
it that suppresses display of one or the other.

Change the format of the textbox to General Date or define a custom format,
and you'll be set.

<rofl> Oh, well, D'UH!! <lol> Thanks so much. I was getting all confused
between Excel and Access. I should remember that many of the features of
Excel are found in a similar format in Access. The tangles we get in as
newbies, eh?! <g> I see now that the pulldown actually accepts formatting,
something that hadn't occurred to me. I typed the date/time format I needed
in the properties box of that =NOW() field and, sure enough, as you said it
would, got the date and time displayed as needed. Thanks! :eek:D
--
Joan Wild
Microsoft Access MVP
At the top of the entry form for the contacts example database, there
is this line of code in a box:

=IIf(IsNull([lastname]),"",[firstname] & " " & [lastname] & ", " &
[Birthdate])

That got me to thinking how nice it would be to put in the FOOTER of a
REPORT the date and time rather than having one box for the date with
=NOW() and one for the time with =NOW() each formatted to show either
date/time. That might not be the right way to do this, but that's
what this newbie figured out some time back and that's what she uses
<g>.

Seeing how that code above uses "" and &, etc., to put different
codes into one box, can we do the same time of thing for the date and
time so that it all comes out naturally even on one line with correct
spacing between date and time? (Currently, esp. since I haven't
figured out how to slide in Access yet, there's a big space sometimes
between date and time depending on the length of a month's name and
they're sometimes a bit uneven until I adjust the field boxes in the
properties. All would be properly taken care of if date/time in one
field box.)

Thanks!
 
S

StargateFanFromWork

StargateFanFromWork said:
<rofl> Oh, well, D'UH!! <lol> Thanks so much. I was getting all
confused



I now have a universal approach to this and thought I'd share. I get the
following display:

Sun.Dec.04.2005; 16h03



when I just dump this into the format box in the properties of the "=NOW()"
field box (or whatever it is properly called):

ddd\.mmm\.dd\.yyyy"; "hh\hnn



Perfect.

Thanks for helping with this. It's very different from Excel, but it still
can be done, which is all that counts.

:eek:D

[snip]
 
Top