Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning part of a number with a query

Status
Not open for further replies.

44macfan

IS-IT--Management
Apr 30, 2001
7
CA
I have a table with a field that contains 13-18 digit "type" codes. I wish to run a query that will return only the last three digits of this code.
Is there a way of formatting the field in the query to do this? Or some other method?

Thanks
 
If the database field is of type Text, change the field in the query grid to "TypeLast3: Right$([Type],3)"

If the database field is of type Number, use this instead: "TypeLast3: [Type] Mod 1000". If you use this, leading zeros on the last three digits will be suppressed. If you don't want that, try this: "TypeLast3: Right$(Format$([Type],"000"),3)" Rick Sprague
 
MyRight3: Right(Str([MyNumField], 3))
MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Thanks Guys

TypeLast3: Right$([Type],3) worked

Chad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top