"David Peake" <david.peake.TakeThisOut@beeceeemeneetee.com> wrote in message
news:1086606243.96626.0@despina.uk.clara.net...
> This is really bugging me!
>
> I have a table that audits useage (date, time & user etc).
>
> Every time a user changes a record it modify the record to say what
> date it was last modified. Easy so far:
>
> SQL="Update TBLCustomer SET ModifyDate=#" & format(date(),
> "dd/mm/yyyy") & "#"
> cnn.Execute SQL
>
> (I'm in the UK so I want the date to be in dd/mm/yyyy format)
>
A date in an ADO database is not in any format. It is an 8 byte floating
point value (days, with fractional days for time). Once you get the
correct date in, you can then display it in any format you like.
When the above executes on 07 June 2004, the date is converted to a
string: "#07/06/2004#", per your instructions. To Access, this is the
7th day of July 2004.
A well buried quote from the Access Help File:
"When you specify the criteria argument, date literals must be in U.S.
format, even if you're not using the U.S. version of the Microsoft Jet
database engine. For example, May 10, 1996, is written 10/5/96 in the
United Kingdom and 5/10/96 in the United States."
You could use the "universal" format to get the date in: "yyyy/mm/dd",
i.e. 2004/06/07. This is more portable between different database
systems. You can always display the data using whatever format you like.
Or, don't pass the date as a string at all, but instead use a command
object, and add a parameter of type adDate.<!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: Access/VB Date Format Problem