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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing last 7 chars in query

Status
Not open for further replies.
May 21, 2003
64
0
0
US
I have a department description and the its corresponding number on the same line. I would like to remove the number, which always takes up the last 7 spaces in the description. I tried right(department,7)...and was left with the numbers, not the description w/o the numbers. Can't remember the right function for access 97. Any help would be greatly appreciated
 
Derek,

Hopefully you'll split this into two fields, as that will make things a lot easier in the future.

Here's how I'd do it (after adding two new fields):
UPDATE tblWhatever SET NewF1 = right(Departement, 7), NewF2 = left(department, len(department) - 7)

You may want to change the last 7 to 8 if there's a space or some other character between the description and the number.

Hope this helps.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Why not use the Left("Your string", Len("Your string")-7)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top