Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002

    Exclamation Unanswered: Convert text to a date


    I am relatively new to using Access and have run into a problem. I am importing a spreadsheet that shows a date field in the following format:

    e.g. 1020131

    What this means is that it is January 31. The 102 is meaningless. I want to reformat the field to display as 01/31/2002. I am trying to build an expression to do this. So far I have come up with:

    NewDate: Right([Date Stamp],4) & "2002"

    My expression displays this:


    The next step is to format this into a proper date format. Plus I would really like my expression to show the current year. Don't want to hard code the year like I am presently doing. Help!
    Last edited by Susan; 01-31-02 at 16:53.

  2. #2
    Join Date
    Jan 2002
    At the Edge of America!
    If your year is formatted the same each time. You can do this.

    Function NewDate(strDate As String) As Date

    Dim strDate As String

    NewDate = CDate(Mid(strDate, Len(strDate) - 3, 2) & "/" & Right(strDate, 2) & "/" & Year(Date))

    Debug.Print strNewDate

    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts