Crystal wrote in message said:
Thanks, Douglas!
I have had troubles using date functions with foreign databases... now I know
why!
Thank you so much for tagging on...
I have never thought to use # in the Format code -- makes sense!
So, CLng(Date()) returns the serial number... does Date() just return the
American format?
Have an awesome day
Warm Regards,
Crystal
MVP Microsoft Access
strive4peace2006 at yahoo.com
Also ISO 8601 is widely used
http://en.wikipedia.org/wiki/ISO_8601
"yyyy-mm-dd", "yyyy-mm-dd hh:nn:ss"
Allen Brownes explaines some of the date challenges here
http://allenbrowne.com/ser-36.html
Clng(date) - be aware though that playing with those numbers might
provide some anomalities on other platforms. 38769 might be todays date
for Jet, and will probably work quite well within the Jet interface,
but
you might experience some anomalities with other platforms, depending
on
in which way you pass this serialnumber.
Try SQL server - execute a query passing todays serialnumber both on a
linked table and on a separate (ADO) connection to the same table and
check the results (my guess is they would be they are two days off)
I don't know much about the inner workings of the Date function, but I
suppose it returns a value representing today date as the datatype Date
(which I think is an 8 byte floating point datatype (similar to, or the
same as Double?), where the decimal part is zero). I don't think the
Date function itself returns a specific format, but that the format is
determined and applied whenever a value of this datatype is presented
in
the UI, IDE or concatenated into strings. If a format is specified for
the form/report control, string or whatever, this is used, else Access
fetches the date format from the regional settings.
When using dynamic SQL, we're passing a string to the db engine, where
we need to make sure the information we send is as unamiguous as
possible, so that it is interpreted correct regardless of locale. For
dynamic SQL strings, such formatting might be necessary for both dates
and non-integer numeric datatypes (which might make it interesting to
start utilizing the parameters collection of the objects one ar using
in
stead ;-) )