Results 1 to 8 of 8
  1. #1
    Caysteve is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    5

    String Query

    Hi, Can enyone tell me what code to use to return a query for a specific number of charachters on a string..

    I want to screen postcodes between 6 digit and 7 digit in query reports..




    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,640
    Check out the Mid() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Caysteve is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    5
    Thanks Paul, but the MID fnction seems to return a section of the string rather than seperate them out.. eg .. if I select 6 as the length it will return 6 charachters out of a 7 string record.

    I need to be able to sort , 6 character and 7 character postcodes and then use the Left function to search.

    IE SO20xxx and not SO20xx if that makes sense..

    cheers,

  4. #4
    Caysteve is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    5
    Think I might have solved it using the "Len" function.

    Cheers,

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Perhaps I misunderstood the goal. The Mid() function would have let you peel out the 6th and 7th characters. Did you mean codes 6 or 7 characters long? If so, yes the Len() function is more appropriate.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    Caysteve is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    5
    Thanks, yes Len function works fine so sorted now.

    Cheers, Steve

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

  8. #8
    Caysteve is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2011
    Posts
    5
    Cheers, and as an Access newbie.. it looks like I will be using it a lot in the weeks to come..

    Thanks

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

Similar Threads

  1. Replies: 1
    Last Post: 07-07-2011, 08:32 PM
  2. Replies: 3
    Last Post: 04-19-2011, 06:41 PM
  3. Query based on incompatible string lengths
    By dwil98059 in forum Access
    Replies: 4
    Last Post: 03-31-2011, 08:00 PM
  4. Split a string for use as query parameters.
    By Hobbes29 in forum Forms
    Replies: 3
    Last Post: 06-27-2010, 04:39 PM
  5. Replies: 0
    Last Post: 12-05-2005, 04:09 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