Convert 01-JAN-1999 from text to date

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ratsat
    New Member
    • Dec 2009
    • 1

    Convert 01-JAN-1999 from text to date

    I have a database with over 100,000 records and the dates are all stored as text fields 01-JAN-1999. I need to convert them to a date field and have tried numerous options on my own and in examples posted on threads. I am in a crunch to get this done, need a quick fix from the experts! Thanks!
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Replace FauxDateField with the actual name of your control/field:

    In VBA behind a form:

    CDate(Me.FauxDa teField)

    In a Query

    RealDateField:C Date([FauxDateField])


    Having said that, for the VBA date functions, such as DateAdd() and DateDiff(), using the Text field you currently have will work just fine. Access/VBA is very accommodating that way, if it looks like a date it will consider it to be a date!.

    Welcome to Bytes!

    Linq ;0)>

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32656

      #3
      You may need to write a query to do the update of the data for you. Clearly it would involve the technique as described here by Linq. The SQL for the query would be something very like :
      Code:
      UPDATE [YourTable]
      SET [FixedDateField]=CDate([FauxDateField])
      You are responsible for creating the new field to store the data in, and changing the SQL to match the names of your fields. We can help, but only with the relevant information provided.

      Comment

      Working...