Results 1 to 6 of 6
  1. #1
    micwev is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    1

    convert a string such as 20190610 into a report where it should look like 10-06-2019

    Hey,


    I have a report based on a query that contains the text 20190610
    How can I convert a string such as 20190610 into a report where it should look like 10-06-2019
    Use of left, right and mid does not give the desired result
    Who can help me?
    Thanks in advance (from the Netherlands) for your cooperation !!

  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,515
    Using those inside the DateSerial function should give you a date field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,702
    Use of left, right and mid does not give the desired result
    You might be close with that, but I can't see what you tried from here!
    I tried DateSerial but couldn't get it to work with 20190610. It needs (2019,06,10) and if you can make 20190610 into 2019,06,10 you should be able to use Right, Mid or Left directly.

    Maybe look at https://www.access-programmers.co.uk...d.php?t=144603 as one of a gazillion examples out there.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  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,515
    Quote Originally Posted by Micron View Post
    I tried DateSerial but couldn't get it to work with 20190610. It needs (2019,06,10)
    I suggested using the string functions inside the DateSerial function, to provide those values.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,702
    Ahh, I took " those" to mean the values. As you can see, there's more than one way to be slow.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,515
    In retrospect, I could have stated it more clearly. It was very clear in my head.
    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. To convert string value
    By Alex Motilal in forum Programming
    Replies: 1
    Last Post: 02-06-2017, 05:50 AM
  2. Convert String to Date
    By swenger in forum Access
    Replies: 2
    Last Post: 01-31-2017, 03:03 PM
  3. How to convert Date to String?
    By thebaul in forum Access
    Replies: 1
    Last Post: 08-01-2012, 05:51 AM
  4. How to Convert string to Number?
    By taimysho0 in forum Programming
    Replies: 1
    Last Post: 02-24-2012, 01:57 PM
  5. Convert string to date
    By ~SwAmPdOnKeY~ in forum Queries
    Replies: 4
    Last Post: 09-11-2008, 07:19 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