Results 1 to 7 of 7
  1. #1
    dastr is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    8

    field with musltiple entires

    Hi all,

    I have a column in a table where in one cell, I have multiple entries like: 2, 23, 45, 88 - separated by comma.

    I was wondering what i may do in teh quesry, so that i get rid of the entries after teh first comma in the cell.



    Thanks for yr help in advance.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You can use the Left function along with the InStr function to find the position of the first comma.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dastr is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    8
    Hi there,
    and what if I have also cells with single entries, ie there is no comma? If I run

    Trim(Left([Sizes],[CommaPos]-1))

    the single entries will be omitted?

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Using pbaldy's logic, just check if below gives some guidelines :

    Code:
    IIf(InStr([Sizes],",")=0 Or IsNull([Sizes]),[Sizes],Left([Sizes],InStr([Sizes],",")-1))
    Thanks

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    The entry is actually a text string, not a multi-value field? It looks like a string because of the spaces - just making sure because multi-value fields cannnot be parsed with string manipulation.
    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.

  6. #6
    AcsDb Guest
    Windows 7 64bit Access 2010 32bit
    Function "Left()" acts on a string.... so you should be fine

  7. #7
    dastr is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    8
    Thank you!! Much appreciated.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-03-2012, 10:17 PM
  2. Count responses based on entires of other table
    By VictoriaAlbert in forum Queries
    Replies: 2
    Last Post: 10-18-2011, 11:06 PM
  3. Replies: 3
    Last Post: 10-03-2011, 02:33 PM
  4. Replies: 9
    Last Post: 12-15-2010, 01:44 PM
  5. Delete empty entires
    By justinwright in forum Queries
    Replies: 3
    Last Post: 07-22-2010, 11:27 AM

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