Results 1 to 6 of 6
  1. #1
    The Professor is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Cambridgeshire, UK
    Posts
    67

    Extracting Part of a Field


    Hello,

    I'm wanting to know if I can, within a query, extract only part of a field.

    The reason is, I'm doing a mail merge, using an Access Query as a source. However the clients names are held within the database in full, ie - "David John Brown" but in places, within the letter, I only want to use the first name, "David" and not the rest. How, within the Query, can I extract just the first name, is this possible?

    Prof.

  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,652
    You can combine the Left() function with InStr() to find the first space.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    The Professor is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Cambridgeshire, UK
    Posts
    67
    Hello Paul,

    Thank you for your speedy reply - appreciated.
    I understand in principle what you mean, but would you be able to post a simple example of what that might look like in practice? I suppose what I'm asking is, could you 'draw me a diagram' as it were?

    Prof.

  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,652
    You're a professor and I have to draw a diagram?!?

    Left(FieldName, InStr(...))
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    The Professor is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Cambridgeshire, UK
    Posts
    67
    [QUOTE=pbaldy;296024]You're a professor and I have to draw a diagram?!?

    Yes, yes - I wondered how long it would be before someone cracked that particular joke. But, then again, being a professor means I can understand very complex diagrams! Anyway thank you for that and I shall now go away and study your very helpful and detailed diagram.

    Prof.

  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,652
    Detailed? I tried not to be too detailed. I was going for the "Teach how to fish" level of detail.

    Post back if you get stuck.
    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. Replies: 1
    Last Post: 05-27-2015, 08:57 AM
  2. Part of field matches part of another field
    By fishhead in forum Queries
    Replies: 13
    Last Post: 04-10-2015, 01:54 PM
  3. Replies: 16
    Last Post: 11-03-2014, 02:38 PM
  4. extracting data from field
    By focosi in forum Queries
    Replies: 6
    Last Post: 02-11-2012, 03:12 AM
  5. Extracting text from a field
    By bwash70 in forum Access
    Replies: 4
    Last Post: 11-24-2010, 08:10 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