Results 1 to 8 of 8
  1. #1
    JangLang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    7

    Parse in Query

    This is an easy one but I'm fairly new to this. In a query, I have the following data. If a number is six digits, I need to parse the sixth digit and that becomes a new field. If it has five or fewer digits, no record is entered into Column2. For example:

    Column1 Column2


    12345
    54321
    123456 6
    12
    123
    987654 4
    6

    What simple code does it take to perform this in a query? Thanks!

  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,521
    Something like

    IIf(Len(FirstField) =6, Right(FirstField, 1), "")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    JangLang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    7
    Thanks Paul!

    Will that work if the number is seven or eight digits? Will it parse anything past five digits?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No, that does what you asked. You could change the test to >5 and use the Mid() function instead of Right().
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    JangLang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    7
    You're right Paul. And your response to the question I asked worked perfect. I'm not even good enough to know what to ask! I appreciate your help!!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Did revising the formula do what you wnt?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    JangLang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    7
    Yes Sir...thank you so much! I'm just learning this stuff and am eager to learn more. Thanks again!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Parse Data by Month
    By dccjr in forum Queries
    Replies: 6
    Last Post: 04-01-2013, 09:15 AM
  2. How To Parse and Re Write A Date Field
    By abrogard in forum Access
    Replies: 2
    Last Post: 07-08-2012, 07:19 PM
  3. Function to Dynamically Parse Text
    By avandalay in forum Access
    Replies: 2
    Last Post: 07-27-2011, 04:07 PM
  4. Replies: 7
    Last Post: 07-21-2011, 01:01 PM
  5. parse on the fly when running a query
    By johnmerlino in forum Queries
    Replies: 9
    Last Post: 11-19-2010, 10:18 PM

Tags for this Thread

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