Results 1 to 3 of 3
  1. #1
    pattrickcolin is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2014
    Location
    southend on sea
    Posts
    44

    Queries by case


    Within a query I wish to restrict all fields where it is lower case only.
    E.G.
    A, Aa, aAb....... is returned

    Whilst
    a, aa, aab..........is not returned

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    By default access is case insensitive.
    If you want to test for lowercase, I suggest you look to vba and use the asc() function.

    see http://www.techonthenet.com/access/f...string/asc.php

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    My suggestion would be to add the following function to a module in your db:
    Code:
    Public Function CountCapitals(strInspect As String) As Integer  CountCapitals = 0
      If strInspect & "" = "" Then Exit Function
      Dim StrLn As Integer
      For StrLn = 1 To Len(strInspect)
        Select Case Asc(Mid(strInspect, StrLn, 1))
          Case 65 To 90
          CountCapitals = CountCapitals + 1
        End Select
      Next StrLn
    Then add the following Where clause to your query:
    WHERE (((CountCapitals([YourTextField]))>0))

    Replace YourTextField ​with the name of your field.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. CASE in SQL
    By alka in forum Access
    Replies: 12
    Last Post: 11-27-2013, 04:15 PM
  2. Queries based on a Select Case
    By dccjr in forum Queries
    Replies: 3
    Last Post: 03-05-2013, 04:12 PM
  3. Replies: 5
    Last Post: 10-23-2012, 03:55 PM
  4. Case when
    By krufruf in forum Queries
    Replies: 2
    Last Post: 07-20-2012, 03:59 PM
  5. Case Else
    By FinChase in forum Programming
    Replies: 3
    Last Post: 02-01-2012, 10:45 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