Access query based on number of characters

S

Susana C

Hi,

I have a table with 302000 records and I need to query column A to only pull
the items with 8 characters in the field. I've tried Like "********" but
this pull all data and Like "????????" pulls not data... please help!

Thanks
 
R

Rick B

Add a new column to your query with the following in it...

LengthOfField: Len([YourFiledNameHere])


Then, in your criteria under this column, put...

=8
 
A

Allen Browne

In the Field row in query design, enter:
Len([Field1])
substituting your field name for Field1.

In the Criteria row under this field, enter:
8

It will take several seconds to execute the query with this criteria dn 300k
records.
 
B

Baz

Susana C said:
Hi,

I have a table with 302000 records and I need to query column A to only pull
the items with 8 characters in the field. I've tried Like "********" but
this pull all data and Like "????????" pulls not data... please help!

Thanks

SELECT * FROM some_table WHERE Len(some_field) = 8
 
S

Susana C

It worked!! Thank you!

Allen said:
In the Field row in query design, enter:
Len([Field1])
substituting your field name for Field1.

In the Criteria row under this field, enter:
8

It will take several seconds to execute the query with this criteria dn 300k
records.
I have a table with 302000 records and I need to query column A to only
pull
the items with 8 characters in the field. I've tried Like "********" but
this pull all data and Like "????????" pulls not data... please help!
 

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