Results 1 to 3 of 3
  1. #1
    rbrem is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    7

    format text string as date

    Please help me format a text field as a date. I have the following inception dates listed as text fields in yyyymmdd format. I want to change them into dates. For example, 20110726 becomes 7/26/2011. The expression Format([Inception_date],"mm/dd/yyyy") is giving me a Num! error.

  2. #2
    GeekInOhio's Avatar
    GeekInOhio is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    25
    It has no way to know that the provided string is in yearmonthday order. Use DateSerial() to break the string down yourself:

    Code:
        Dim myString As String
        Dim myDate As Date
        
        myString = "20110726"
        myDate = DateSerial(Left(myString, 4), Mid(myString, 5, 2), Mid(myString, 7, 2))

  3. #3
    rbrem is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    7
    That worked, thank you very much.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-23-2012, 04:30 PM
  2. tRNASFER text FILEd INTO DATE FORMAT
    By BorisGomel in forum Access
    Replies: 1
    Last Post: 01-05-2012, 10:08 AM
  3. Check text box string format
    By udik in forum Access
    Replies: 3
    Last Post: 01-04-2012, 01:24 PM
  4. Replies: 1
    Last Post: 08-07-2011, 07:58 AM
  5. Format within a string
    By wdrspens in forum Reports
    Replies: 1
    Last Post: 04-16-2011, 05:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums