Results 1 to 2 of 2
  1. #1
    b4btec is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Mar 2016
    Posts
    1

    Query that takes a portion of a string and moves it to a new field

    I have a field that some bright person decided to use as two fields. Basically, this field may have any number and type of characters (or none) before a string that starts has NMFC#. The substring that starts with NMFC# always goes to the end of the field. Basically what I need to do is take a substring of NMFC# and everything after it and move it to a new field in the table, leaving the random strings in the original field. What is the best way to accomplish this?

    A sample of the data in this field:



    50#/CS NMFC# 151320
    50#/CS NMFC# 151320
    50#/CS NMFC# 151320
    500#/DRUM NMFC# 4610
    500/rl NMFC#153500-2
    500405 NMFC# 154675
    500516 NMFC# 154675

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You can do a calculated field in a query (and just leave it as that).
    You could write it back to a table field if you really want to, but that usually isn't necessary, since you can use a Query for pretty much anything that you use a Table for.

    Here is what that calculated field would look like:
    Code:
    MySubstring: Mid([FieldName],InStr([FieldName],"NMFC#"))

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

Similar Threads

  1. Replies: 7
    Last Post: 01-21-2016, 08:59 PM
  2. Replies: 2
    Last Post: 10-12-2012, 02:33 PM
  3. Replies: 1
    Last Post: 06-12-2012, 01:54 PM
  4. Bold portion of text in memo field.
    By kenton.l.sparks@gmail.com in forum Access
    Replies: 1
    Last Post: 05-01-2012, 03:32 PM
  5. Replies: 1
    Last Post: 06-09-2006, 05:44 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