Results 1 to 4 of 4
  1. #1
    xmattxman is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jul 2017
    Posts
    19

    Filter out anything that comes before a certain text in a query

    I have a query shown below. I need to filter out everything before Disposition and just pull out the line that starts with disposition and every line after that. I cant really use the line # as a criteria because that line number is different depending on the amount of text before it. Disposition will always be the last lines in the query results if that helps. Any ideas on how this could be done?



    Code:
    CURRENT QUERY
    
    OH_NUMBER NL_LINE NL_LINE_NO
    0003556 1
    0003556 Original Job #: C# 008 2
    0003556 3
    0003556 Reason: PART WAS ON ORDER BUT RECEIVED 40 PIECES OF 4
    0003556 AND WRONG INSPECTION PAPER. 5
    0003556 6
    0003556 Evaluation: WRONG ITEM SHIPPED 7
    0003556 8
    0003556 Cause: 9
    0003556 10
    0003556 Corrective Action: 11
    0003556 12
    0003556 Disposition:WE SHIPPED THEM THE CORRECT ITEM AND HAVE 13
    0003556 ALREADY CREDITED THIS ITEM THROUGH THE ORDER. 14
    OUTCOME I AM LOOKING FOR
    OH_NUMBER NL_LINE NL_LINE_NO
    0003556 Disposition:WE SHIPPED THEM THE CORRECT ITEM AND HAVE 13
    0003556 ALREADY CREDITED THIS ITEM THROUGH THE ORDER. 14
    Current SQL SELECT OH.OH_NUMBER, PK1_NL.NL_LINE, PK1_NL.NL_LINE_NO FROM OH INNER JOIN PK1_NL ON OH.OH_NMSEQNUM = PK1_NL.NL_NMSEQNUM;


  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Q1 = select *, instr(NL_LINE, "Disposition") as iStart from table where instr(NL_LINE, "Disposition")>0
    Q2 = select [OH#] ,mid(NL_LINE,[Q1],iStart) from Q1

    run Q2.
    Q1 pulls recs that have Disposition,
    Q2 pulls everything Right of the word

  3. #3
    xmattxman is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jul 2017
    Posts
    19
    When I run Q2 it prompts me for Q1 Parameter Value?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,649
    Reference to query object in Mid not valid. Try removing it.
    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: 2
    Last Post: 02-20-2017, 11:28 PM
  2. Replies: 5
    Last Post: 08-30-2016, 12:55 PM
  3. Replies: 9
    Last Post: 02-24-2015, 11:19 AM
  4. Replies: 5
    Last Post: 12-02-2014, 01:20 PM
  5. Replies: 27
    Last Post: 01-21-2013, 02:43 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