Extract string from a text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AccessHunter
    New Member
    • Nov 2007
    • 77

    Extract string from a text

    Hi,

    Please help as this is urgent.

    I have the following data in a column. In the report I want to display them only with whatever is before the "-".

    A SECOND DAY, INC.-FORMAT 4
    A SECOND ADY, INC-VERSION 1
    A SECOND DAY,INC.-VERSION 1
    CLAIR FOUNDATION - OPTION 1
    CLAIR FOUNDATION - OPTION 3
    CLAIR FOUNDATION - OPTION 4
    C.O.T.I.C. - GRADE 3
    RACE D&FS - GRADE 1

    PLease help.

    Thanks in advance
  • Megalog
    Recognized Expert Contributor
    • Sep 2007
    • 378

    #2
    Well, as a quick fix you can either:

    Add this to the control on the report, under it's 'Control Source'
    Code:
    =Trim(Left([YourFieldName],InStr([YourFieldName],"-")-1))
    or

    Go to the report's recordsource, and in design view add in a new field expression, like:
    Code:
    NewFieldforReport: Trim(Left([YourTableFieldName],InStr([YourTableFieldName],"-")-1))
    Just replace the data in the brackets with your actual names.

    Comment

    Working...