Results 1 to 4 of 4
  1. #1
    Steven.Allman is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2010
    Posts
    118

    CDate in my append query

    Importing individual records from a massive database. As I import, i would like to change the format on the fly of the dates, which are stored as text in DB1, as to store them in date format in DB2, my new DB.
    I have seen lots of info on the CDate function but cant figure out where to place it, and how to use it. My query works great, but I need to be able to use this 'date'

    YYYYMMDD is the format in DB1 'TEXT" field



    I could care less what format I get out of it!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    CDate() may not work on that format, but if it does it would look like:

    CDate([YourFieldName])

    If it doesn't work (my guess), you probably need to use DateSerial() with the Mid() function to pull out each component of the date.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    I think you'll need to use your mid and right and left functions to get this:

    mid(yourdate,5,2) & "/" & right(yourdate,2) & "/" & left(yourdate,4)

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can use Mid() for them all:

    ?dateserial(mid("20110411",1,4),mid("20110411",5,2 ),mid("20110411",7,2))
    04/11/2011
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. append query
    By kroenc17 in forum Queries
    Replies: 8
    Last Post: 11-30-2010, 10:09 AM
  2. append query help
    By SlowPoke in forum Access
    Replies: 2
    Last Post: 09-25-2010, 10:47 AM
  3. Append Query (Maybe VBA?)
    By justinwright in forum Queries
    Replies: 14
    Last Post: 07-21-2010, 10:31 AM
  4. Append query won't append
    By yelkenli in forum Queries
    Replies: 5
    Last Post: 02-12-2010, 11:19 AM
  5. Append Query
    By cotri in forum Queries
    Replies: 1
    Last Post: 01-28-2010, 08:52 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