Length of Text

T

TeeSee

I have a text field with 4,5 or 6 character text content. In a query,
how can I extract all records with a length of 4 and then add 6
leading zeros to it

Thanks
 
J

J_Goddard via AccessMonster.com

For a select or update query?

Add an expression field to the query which has len(trim([MyField])) as the
expression, and 4 as the criteria.

Then add another expression field, with the expression as "000000" & [MyField]


If you are using an update query, the "000000" & [MyField] will go in the
Update To row for [MyField].

HTH

John
 
T

TeeSee

For a select or update query?

Add anexpressionfieldto the query which has len(trim([MyField])) as theexpression, and 4 as the criteria.

Then add anotherexpressionfield, with theexpressionas "000000" & [MyField]

If you are using an update query, the "000000" & [MyField] will go in the
Update To row for [MyField].

HTH

John
I have a textfieldwith 4,5 or 6 character text content. In a query,
how can I extract all records with a length of 4 and then add 6
leading zeros to it

Never understood the expression field until now. Many Thanks indeed!
 

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