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
Rick Brandt - 24 May 2007 13:33 GMT
> 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)

Signature
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
RGUBTON - 24 May 2007 13:53 GMT
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
> 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
RGUBTON - 24 May 2007 14:29 GMT
sorry - should have added that the [TEL] in my earlier reply should have your
fieldname in the brackets!
> 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