Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

First 4 Numbers in a 8 number string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 24 May 2007 13:30 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
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.