With the spaces and second part optional, a change is needed.
Discrepancy: Left$([Fieldname], Instr([Fieldname] & " ", " ") - 1)
Corrective Action: Mid$([Fieldname], Instr([Fieldname] & " ", " ") + 5)
Instr() is the function that searches Fieldname for the spaces. What this change does is append 5 spaces to Fieldname for the search only so that the delimiter is guaranteed to be found.
Yes, to your first question. These expressions will work properly when either or both items are missing, and will return all text before/after the delimiter.
Just one more qualification: If Discrepancy has trailing spaces or Corrective Action has leading spaces, the 5 spaces of separation will be part of a 6- or more space run. These expressions will always interpret the extra spaces as leading spaces on Corrective Action.
Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein