formatting to date?

wh00t

Registered User.
Local time
Today, 20:29
Joined
May 18, 2001
Messages
264
Hi

I am writing a db where information is being transferred from another machine using ODBC.

the problem is how the machine reads dates.

the dates come into Access as 1020913
but I need to view this as 13/09/02

is there any way in Access that I can change the number into the required date format?


EDIT - just had a thought, maybe I can prompt the user to enter the date in seperate fields, i.e. day, month, year and then use query to join these fields and search the linked table using that.
 
Last edited:
Try:

Dim strDate as string

strDate = "1020913"

then use DateSerial as follows

DateSerial(Mid(strDate, 2, 2), Mid(strDate, 4, 2), Mid(strDate, 6, 2))

e.g.

MsgBox "Date is " & DateSerial(Mid(strDate, 2, 2), Mid(strDate, 4, 2), Mid(strDate, 6, 2)) gives 13/09/2002

you could format this:

Format(DateSerial(Mid(strDate, 2, 2), Mid(strDate, 4, 2), Mid(strDate, 6, 2)),"dd/mm/yy") to give 13/09/02

Whew!

Jeff
 
ta
 

Users who are viewing this thread

Back
Top Bottom