MS Access date/Time field methods

  • I have a field value "12/07/05 16:32" in MS Access extracted from and Oracle 9i database. 

    Is thier a way that I can extract the full date from the field to be left with "12/07/05"

    The dataPart() in MS Access 2K does not provide this functionality.

    Any suggestions???

  • If you use the format() function you should be able to get just the date out.

    Ex.

    sDate = format("12/07/05 16:32", "mm/dd/yy")

  • Thank you to Corey Perkins for the Format() method.  But this seems to run very slow on a dataset of 15000 records.

    Does anyone know of a faster method I can apply to the dataset???

    Thanks again to Corey.

  • You can set the format in the textbox directly which seems to work much faster (probably because it's done only when data is requested on the screen).

  • You can pull the date apart and rebuild it using datepart or year, month and day.

    eg

    mydate: month([somedate]) & "/" & day([somedate]) & "/" & year([somedate])

    This is probably faster than format because ODBC might send the above to Oracle in Oracle terms.  "Format" is all done in Access.

    Similar code can be done using DatePart.

    mydate:datepart("m",#1/2/2005 00:12#) & "/" & datepart("d",#1/2/2005 00:12#) & "/" & datepart("yyyy",#1/2/2005 00:12#)

    Can you get a look at the sql being submitted to the server to see what ODBC is sending?

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply