?find rows where penultimate digit in a 9 number code in a column

A

AK

As part of a research project I am looking at a database of approximately 33
000 people in microsoft access 2003. One of the columns is a 9 digit code
(all numbers). I need to select all people (rows) where the penultimate digit
in the code is the number 3. I have tried a query with "#######3#" but this
didn't work. I would be very grateful for any suggestions.
 
D

Douglas J. Steele

That will return rows with 3s anywhere in the first eight digits.

You need to use

Like "???????3?"

unless you're using ADO, in which case you'd use

Like "_______3_"

(that's 7 underscore characters in a row before the 3, and one underscore
character after the 3)
 
J

Jerry Whittle

Another option would be to put something like below in a field of a query:

The3: Mid([TheFieldName],8,1)

Then make the criteria = 3.
 
R

RonaldoOneNil

It does n't. I tested it and 123456789 is not returned and that has a 3 in it.
 
D

Douglas J. Steele

My mistake, you're right. The question mark at the end insures that the 3
has to be the second last digit.

Sorry about that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top