Re: us date format



Bob Wickham wrote in message <43d2a9f3@xxxxxxxxxxxxxxxxx> :
Marshall Barton wrote:
Bob Wickham wrote:

I have a form where the user enters a date in each record.
In many records the date stays the same so I have written the following code that inserts the previous records value into the current record.


Private Sub PaymentDate_AfterUpdate()

   Me![PaymentDate].DefaultValue = "#" & Me![PaymentDate] & "#"

End Sub

Works OK, except when the value is inserted it displays as US date mm/dd/yy.
I'm typing dd/mm/yy in the first record
I live in Australia and want it to appear as dd/mm/yy in the next record.


I believe I need to convert the date to a number with CLng but I've tried all sorts of ways and cant get it to happen.



I think all you need to do is set the text box's Format property to: dd/mm/yy

No, sorry Marshall, that didn't make any difference.
The format property was Short Date and I have now changed it dd/mm/yy

In both cases, entering 12/06/05 (the 12th day of June, 2005)in the first record displays as 06/12/05 in the second.

Bob

You need even one step further (watch for linebreaks)

Me![PaymentDate].DefaultValue = "#" & format$(Me![PaymentDate], "yyyy-mm-dd") & "#"

or check out this page by Allen Browne
http://allenbrowne.com/ser-36.html
for more information

--
Roy-Vidar


.


Loading