Results 1 to 4 of 4
  1. #1
    smc678 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    65

    How do you Delimited Text?

    How would I be able to separarte this text STRANG,JENNIFER N either on a table, query, or on a form.


  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Let x represent the field that contains this data.

    Left(x, InStr(x,",")-1) will return STRANG

    Left(Mid(x, InStr(x,",")+1),InStr(Mid(x, InStr(x,",")+1)," ")) will return JENNIFER

    Right(x,1) will return N

    However, if your real data does not follow this pattern for every single record, the expressions will probably fail and a custom function will be needed to accomplish this.
    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.

  3. #3
    smc678 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    65
    Works Sorta. So in my query I have some names like DOWD,DWAYNE and CARBAJAL,EDER J some have a middle int and some dont. Any Ideas?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Breaking the name based on comma is easy, after that gets complicated. Need custom function.

    Google: Access VBA split names

    Review:
    http://www.access-programmers.co.uk/...d.php?t=157134
    http://www.access-programmers.co.uk/...ad.php?t=93148

    Create function that will parse the last name and initial but only call the function if the space is present which indicates initial also present.

    Something like:

    Function BreakName(strName As String, strPart As String) As String
    If strPart = "Last" Then
    BreakName = Left(strName, InStr(strName, " "))
    Else
    BreakName = Right(strName, 1)
    End If

    Then call the function in expression:

    IIf(InStr(Mid(x, InStr(x,",")+1)," ")>0, BreakName(Mid(x, InStr(x,",")+1),"Last"), Mid(x, InStr(x,",")+1)

    IIf(InStr(Mid(x, InStr(x,",")+1)," ")>0, BreakName(Mid(x, InStr(x,",")+1),"Initial"), Null)
    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: 7
    Last Post: 11-20-2012, 05:08 PM
  2. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  3. Having troble exporting a text delimited file
    By itm in forum Import/Export Data
    Replies: 2
    Last Post: 07-18-2011, 06:42 AM
  4. Importing Text Delimited
    By BLD21 in forum Import/Export Data
    Replies: 2
    Last Post: 05-06-2011, 10:23 AM
  5. Replies: 5
    Last Post: 02-20-2011, 08:22 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