Results 1 to 2 of 2
  1. #1
    Lennybig is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    1

    Parse or Split Individual Characters with no Delimiter


    Have used Access for years but am still a beginner when it comes to code...

    I have a table with field "Store_Auth" that is a set 220 characters long with no delimiter similiar to:

    AAUU AU U AAA AAA UU UUUU UA UAUAA AA U AAUAUAUUA A

    you get the picture... Each character represents item authorization for a particular store (185,000 items in the table). "A" is authorized, "U" is unauthorized and blank is for a currently closed store.

    I need to parse or split (not exactly sure what the difference is) this field so that each character (also blanks) is it's own individual column so I can marry it up with the proper store number. Code is easy to find and make work when there is a delimeter present, but I have yet to find anything that will work with this scenario. Any help would be appreciated. - Thanks!

  2. #2
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Use the Mid() Function in a For loop to pull out each individual character:
    Code:
    Dim i As Long
    Dim strCurrentAuth As String ' The current A, U, or blank space being looked at
    
    For i = 0 To Len(rst("Store_Auth")) - 1 Step 1
      ' set variable strCurrentAuth to the character at location i in rst("Store_Auth")
      strCurrentAuth = Mid(rst("Store_Auth"), i + 1, 1)
    
      ' Do your stuff here
      If strCurrentAuth = "A" Then
        ' If the character is an A
      ElseIf strCurrentAuth = "U" Then
        ' If the character is a U
      ElseIf strCurrentAuth = " " Then
        ' If the character is a blank space
      Else
        ' If any other character is encountered
      End If
    Next i

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Using double quote as text delimiter
    By EddieN1 in forum SQL Server
    Replies: 4
    Last Post: 03-11-2012, 08:49 PM
  2. Using pound sign as date delimiter
    By EddieN1 in forum SQL Server
    Replies: 1
    Last Post: 03-07-2012, 10:38 PM
  3. Replies: 3
    Last Post: 01-25-2011, 09:50 AM
  4. Replies: 0
    Last Post: 10-06-2010, 11:56 AM
  5. Replies: 3
    Last Post: 01-15-2010, 02:28 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