Results 1 to 5 of 5
  1. #1
    webisti is offline The Wisher
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    115

    Extract text from a certain word to the right

    Hello
    I have a table with many rows like:
    Vendor Nice Bermingham,Drawing:EDU5467 P/N 12354N
    Vendor Nike London city,Drawing:EDU5467 P/N 18754N
    Athletic Shoes vendor unknown<> Drawing:EDU1167 P/N 18754N

    What I would need is a query to extract the rest of the words starting from Drawing.
    The problem is that the mid() cannot be used since in every row the word Drawing may start in different positions.

    Any ideas on how to solve this issue?



    Regards


    Webisti

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    =mid([field],instr([field],"Drawing:")+8)

  3. #3
    webisti is offline The Wisher
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    115
    This one is more precise actually: Trim(Mid([fieldname],InStr([fieldname],"DRAW"),22)) but there I see the errors like #Func! or #Error
    How can I eliminate them?

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    Is that because THOSE records dont have the word DRAW?
    AND why 22, you said the text AFTER draw. Thats 8 chars.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,970
    Consistency is critical in string manipulation.

    Is there always a colon?

    Mid([fieldname], InStrRev([fieldname],":")+1)

    InStr and InStrRev will error if the field is null.

    Mid([fieldname], InStrRev(Nz([fieldname],""),":")+1)

    Is it always the last 18 characters?

    Right([fieldname],18)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 1
    Last Post: 05-15-2013, 01:24 PM
  2. Extract text from each word document in a file
    By mercapto in forum Programming
    Replies: 11
    Last Post: 03-12-2013, 10:29 PM
  3. Extract Text Data
    By tmcrouse in forum Queries
    Replies: 5
    Last Post: 05-25-2010, 11:34 AM
  4. extract text from memo
    By lions1855 in forum Queries
    Replies: 2
    Last Post: 05-03-2010, 07:28 AM
  5. Extract text from middle of a field
    By AccessNubie in forum Access
    Replies: 3
    Last Post: 11-02-2009, 01:13 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