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

Trim name. sql query???

Status
Not open for further replies.

vickriz

Technical User
Joined
Jan 13, 2003
Messages
1
Location
PH
hi there, i have prob in my table fieldname
FirstName
Anthony Jr.
Martin Sr.
Christopher III.

what i want to do is to trim down the name and move the suffixname into my suffix field.
result should be like this:
FirstName Suffix
Anthony Jr.
Martin Sr.
Christopher III.
 
Hi

You need to understand the use of the functions Right(), Left(), Mid() and Instr() - see Access Help

Before it is possible to give detailed advice, it is necessary to know the 'rules' governing your column FirstName

ie
are there any instances of two names (eg John Paul)?
can one assume that anything comming after a space following the Firstname is a suffix?

assuming No and Yes respectively true

Something like:

FName:=Left([FirstName],Instr(1,[FirstName]," "))
Suffix:=Mid([FirstName],Mid(Instr([FirstName]," ")+1)

Should do it Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top