Results 1 to 7 of 7
  1. #1
    ry94080 is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2019
    Posts
    29

    Function to pull date from free-text field.

    Hello,

    I'm pulling data from our IS system. There is a free-text field that has some explanation text and also some date and time information.

    I was hoping to find some code that would extract the date and time into a separate field to be able to run a calculation against.

    The text has been kind of consistant for the most part. Examples:

    "blahblah blagbhilaieragnleiobnobhreehb Results called by LV00000 at 23:34 on 11/23/2022."



    It's always some random text followed by "called by LV00000 at time on date."

    Any ideas on how to pull these data elements out?

  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
    If it's always at the end, you can use the Right() function if the number of characters is consistent (01/01/2023 rather than 1/1/2023). If not, you can use the Mid() function along with InStrRev() to find the last space.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ry94080 is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2019
    Posts
    29
    It's consistent for the most part but not all the time. I think it has to be some logic where it looks for "/"'s and pulls the date from there.

    Any ideas?

  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
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Paul already gave you the answer with the InStrRev, have you tried it?
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    xps35's Avatar
    xps35 is online now Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    232
    Try CDate(Mid([F1],InStrRev([F1],"/")-5,10))

    (replace F1 with your fieldname)
    Groeten,

    Peter

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Here is an example using Paul's original suggestion and another using the Split function.

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 1
    Last Post: 06-03-2020, 02:44 PM
  2. Free text within a report
    By Scott488 in forum Reports
    Replies: 3
    Last Post: 11-11-2013, 12:25 PM
  3. Replies: 15
    Last Post: 04-06-2012, 10:57 AM
  4. a Question about Free text in a report.
    By fedesc in forum Access
    Replies: 3
    Last Post: 10-26-2011, 11:31 AM
  5. Inputting Free text in Form
    By maintt in forum Forms
    Replies: 2
    Last Post: 08-13-2010, 11:43 AM

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