First 4 Numbers in a 8 number string

D

Dave

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
 
R

Rick Brandt

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)
 
R

RGUBTON

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
 
R

RGUBTON

sorry - should have added that the [TEL] in my earlier reply should have your
fieldname in the brackets!
 
Top