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

Parse Query

Status
Not open for further replies.

theif68

Technical User
Apr 3, 2005
39
US

I am looking to parse names that go into a table in the field "FULLNAME", but I only want this qry to run if there is 1 space in the field.

UPDATE tblStandardLayout SET tblStandardLayout.FNAME = Left([FULLNAME],InStr([FULLNAME]," ")), tblStandardLayout.LNAME = Mid([FULLNAME],InStr([FULLNAME]," ")+1);


This would be because I dont want it to try to parse names that are not just "First Last"

 
add a where clause
Code:
where [FULLNAME] like "* *"

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
I think that checking for one space is not enough, I think you will have to check that there are not two spaces, perhaps something like:

[tt]Where Len(Trim(Fullname))-Len(Replace(Trim(Fullname)," ", "")=1[/tt]
 
... And Trim(Fullname & " ")<>""
to make sure that it is filled in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top