Access query based on number of characters

  • Thread starter Thread starter Susana C
  • Start date Start date
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
 
Add a new column to your query with the following in it...

LengthOfField: Len([YourFiledNameHere])


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

=8
 
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.
 
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
 
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!
 
Back
Top