On Tue, 15 Apr 2008 18:25:11 -0400, MLH <CR**@NorthState.netwrote:
>Sometimes it works and sometimes it crashes.
If I want "Today is " & Date$ & "." to appear
in a query field, why might it work sometimes
and not others?
Would I be better to call a FN? Say, something
like "Today is " & GetDateString() & "." ???
If 'Yes' - why is that?
Date$ and Now() are two rather different functions, and both follow
different paths to get the system date and time settings back to
whatever is calling them.
Date$ doesn't "honor" the Windows date and time format settings for
example, while both the Date() and Now() functions will. Surprisingly
however, I've personally found that Now() is faster then Date$.
(Indeed, even Format$(Now(),"mm/dd/yyyy") is faster then Date$. Your
milage however, may vary.)
The Date$ and Now() functions also return 2 different types of data.
Date$ returns a string, Now() returns a date. (Well, ok, it's a
Variant sub-type Date, but it's close enough to a date that Access
won't appear to care, while it will care if it has to handle a String
as if it was a date, for sorting, grouping, etc.)
As for using a module level function to get the date rather then the
Now() function (or Date() function for that matter), I've only had to
result to that when I've needed further processing on the information,
or in cases where I needed a date that was "universal" across many PCs
in multiple locations. For example, when I needed a date (and/or
time) that was going to be the same everywhere across an organization,
regardless of where the user was, or despite what they did to their
computer's clock.
--
Please Post Any Replies To This Message Back To the Newsgroup.
There are "Lurkers" around who can benefit by our exchange!