Results 1 to 3 of 3
  1. #1
    Lynn Cohen is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    30

    Query to return records containing 2 characters in a field

    I have a field in Access 2010 called Section Number which generally holds two characters. The characters can be numbers, letters, or a combination. Examples are:


    01
    X1
    KA
    40

    Sometimes this field holds three characters, such as:
    01a
    02b

    I want to write a query that returns only the Section Numbers that contain two characters. The instances where the field holds three characters are too numerous and changeable to use a parameter that says, for example: not "01a" and not "02b"

    Is there a way to write a parameter that means "not Section Numbers of three characters" or "not Section Numbers of more than 2 characters"?

    Thanks,
    Lynn

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Just add criteria to only return values that have a length of two, i.e.
    Code:
    ...
    WHERE LEN([Section Number])=2;

  3. #3
    Lynn Cohen is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    30
    Perfect! Thanks so much.

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

Similar Threads

  1. Replies: 5
    Last Post: 03-22-2013, 01:11 PM
  2. Replies: 9
    Last Post: 02-11-2013, 03:09 PM
  3. Replies: 1
    Last Post: 05-10-2011, 12:06 PM
  4. Replies: 5
    Last Post: 03-10-2011, 02:19 PM
  5. Replies: 12
    Last Post: 10-15-2010, 10:03 AM

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