First 4 Numbers in a 8 number string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to pull data from a table with a Query, which I have but now I
need to make it pull ONLY the first 4 numbers in a 8 digit string... Need
help on this if any one can assist
 
Dave said:
I am trying to pull data from a table with a Query, which I have but
now I need to make it pull ONLY the first 4 numbers in a 8 digit
string... Need help on this if any one can assist

Left([FieldName], 4)
 
Dave,
I think you need to create an expression in a blank column of the query and
use the LEFT$ function.

If the numbers really are held as a string (Text datatype) then
"Expr1: Left$([TEL],4)" should work

If the data is held as numeric data then use the CStr function to convert it
to string data befor chopping off the left 4 characters:
"Expr1: Left$(CStr([TEL]),4)"

Type one of these phrases (with out the speech marks) into the top line of a
blank column of your query (in design view). And make sure the 'Show' box is
checked!

Obviously you may want to change the defauult name of 'Expr1'. You can of
course use the expression builder to create the expressions for you.
Good luck
 
sorry - should have added that the [TEL] in my earlier reply should have your
fieldname in the brackets!
 

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

Back
Top