Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    India
    Posts
    41

    Unanswered: Importing a date/time field in Access table

    Hi,

    I have created an access table with three fields.

    InstanceName - Text
    Date - Date/Time
    Description - Text. (Set to Custom format - yyyymmdd hh:nn)

    Iam trying to import the data from a text file which looks like this

    QA01SH11|20071201 12:30|Test.

    When i try to import this file the second field is not getting imported due to Type conversion error.

    Any help is appreciated,

    Thanks,
    Arun

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I think what you are going to have to do is to do the import in two steps.

    1. Link the the file, make sure when you link to the date field you make it a text field

    2. Then create a query that uses the Left and Mid functions to put the text date into a date format Access recognizes. An make it append to the table you want or create a Make Table query.

    Something like:

    CDate(Mid([x],5,2) & "/" & Mid([x],7,2) & "/" & Left([x],4) & Mid([x],9,999))

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yup. Or use code to import the data.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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