Trimming Data and inserting contents into new columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jammin140900
    New Member
    • Aug 2008
    • 3

    Trimming Data and inserting contents into new columns

    Hi there

    I have a table which I have brought in from another database and need to seperate some of the data in one field where applicable into 2 fields. I've placed some examples below to explain further.

    AQTF
    AQTF - Ext Scope
    AQTF - First 12 Month
    AQTF - Registration
    AQTF - Re-registration
    AQTF - Special
    AQTF - Verification

    You'll see for the sample data above, the first entry is just AQTF, whilst the following entries have something attached to it. Where the entries have something attached to it, I need to seperate them into AQTF (Column 1) and the remaining contents to be moved into a new Column.

    Not quite sure what's the easiest way of doing this. Could you please advise?

    Thanks
    Jammin
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Try this:

    Code:
    Dim  NewColumn As String
    
    If InStr(Mid(Column1, 6, 1) , "-") <> 0 Then
    	Column1 = Left(Column1, 4)
    	NewColumn = Trim(Mid(Column1,7, Len(Column1)))
    End If

    Comment

    Working...