• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 503
  • Last Modified:

Access Query - How to query text fields looking for specific lower and upper case text strings.

How can I create a query that generates text strings with exact lower/upper case?

I would like a query which generates all products that start with lower case "a"
I would like a query which generates all products that start with upper case "A"
0
brothertruffle880
Asked:
brothertruffle880
  • 2
  • 2
2 Solutions
 
cyberkiwiCommented:
select * from products where Asc(Left(code,1)) = Asc("a")
select * from products where Asc(Left(code,1)) = Asc("A")
0
 
cyberkiwiCommented:
ASC looks at the first character only, so these are equivalent:

select products.* from products where Asc(code) = Asc("a")
select products.* from products where Asc(code) = Asc("A")

http://www.techonthenet.com/access/functions/string/asc.php
0
 
Dale FyeCommented:
Use the string comparison function strComp().

Check out Access help for the syntax and the retrun values.  you will want to use vbBinaryCompare as the 3rd parameter.
 
0
 
brothertruffle880Author Commented:
Where do I type these things in the query design view?
err.jpg
0
 
Dale FyeCommented:

To test the the first character of [SomeField] = "A", add a new column to the query grid, like:

Expr1:strComp(left([SomeField], 1), "A", 0)
Criteria: 0

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now