473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Parsing out Firstname from Given Names

I am using an update query to parse out the Firstname of a person from a
field (GivenNames) in a list of names. The criteria I am using is

Left([GivenNames],InStr(1,[GivenNames]," ")-1)

This works fine if the person actually has more than one name, but gives me
errors if the person only has one name in the first place and puts a null
into the Firstname field in that instance. How can I get it to just copy
the single name into the Firstname field for cases where the person only has
one first name?

dixie
Nov 12 '05 #1
3 2108
Dixie,

For cases where the person only has one first name, there will be no space.
InStr(1,[GivenNames]," ") returns 0 when there is no space. Maybe you can work
that into what you are doing.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"dixie" <di****@dogmail.com> wrote in message
news:Lb****************@nnrp1.ozemail.com.au...
I am using an update query to parse out the Firstname of a person from a
field (GivenNames) in a list of names. The criteria I am using is

Left([GivenNames],InStr(1,[GivenNames]," ")-1)

This works fine if the person actually has more than one name, but gives me
errors if the person only has one name in the first place and puts a null
into the Firstname field in that instance. How can I get it to just copy
the single name into the Firstname field for cases where the person only has
one first name?

dixie

Nov 12 '05 #2

"dixie" <di****@dogmail.com> wrote in message
news:Lb****************@nnrp1.ozemail.com.au...
I am using an update query to parse out the Firstname of a person from a
field (GivenNames) in a list of names. The criteria I am using is

Left([GivenNames],InStr(1,[GivenNames]," ")-1)

This works fine if the person actually has more than one name, but gives me errors if the person only has one name in the first place and puts a null
into the Firstname field in that instance. How can I get it to just copy
the single name into the Firstname field for cases where the person only has one first name?

dixie


I think this will do what you describe:

Iif(InStr([GivenNames], " ") > 0, Left([GivenNames],InStr(1,[GivenNames],"
")-1), [GivenNames])

HTH,
Randy
Nov 12 '05 #3
Sure does, thanks Randy.
I have also learned that I can use an IIf statement in a query which I would
not have suspected previously.

dixie

"Randy Harris" <ra***@SpamFree.com> wrote in message
news:My*******************@newssvr15.news.prodigy. com...

"dixie" <di****@dogmail.com> wrote in message
news:Lb****************@nnrp1.ozemail.com.au...
I am using an update query to parse out the Firstname of a person from a
field (GivenNames) in a list of names. The criteria I am using is

Left([GivenNames],InStr(1,[GivenNames]," ")-1)

This works fine if the person actually has more than one name, but gives me
errors if the person only has one name in the first place and puts a null into the Firstname field in that instance. How can I get it to just copy the single name into the Firstname field for cases where the person only

has
one first name?

dixie


I think this will do what you describe:

Iif(InStr([GivenNames], " ") > 0,

Left([GivenNames],InStr(1,[GivenNames]," ")-1), [GivenNames])

HTH,
Randy

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: george young | last post by:
For each run of my app, I have a known set of (<100) wafer names. Names are sometimes simply integers, sometimes a short string, and sometimes a short string followed by an integer, e.g.: 5, 6,...
5
by: Chris Vendel | last post by:
I'm in doubt as to how best to handle the following 'challenge'... I want to render an XML file from two XML sources. One is a template and the other (if available) contains data I wish to add....
3
by: dixie | last post by:
I am using an update query to parse out the Firstname of a person from a field (GivenNames) in a list of names. The criteria I am using is Left(,InStr(1,," ")-1) This works fine if the person...
2
by: Ben Fidge | last post by:
Hi I'm trying (and failing) to create and regular expression for parsing peoples names. I simply want to make sure that a firstname and surname, at least, can be extracted. For example, "Ben...
7
by: hal | last post by:
Hello, I'm a beginner to C# programming and working on some exercises. I have form where a user enters their name and when they click on a button it parses their name and puts it on 3 seperate...
7
by: sbowman | last post by:
I have a completely lame string parsing question, but I need an answer fast and I know this is where to get it...I'm not completely familiar with the Len, Right, Left, and mid functions and I have...
4
by: william | last post by:
Hello, I've imported an excel spreadsheet with a Name column which is formatted as Last, First, MI. Some examples I have in the Name column: Smith, Ellen P. Jones, Mary Jane...
1
by: danep | last post by:
Hi, I'm fairly new to AJAX, but I've been able to retrieve HTML and plain-text documents without any trouble. However, I haven't figured out how to retrieve it in XML format. Basically, here's...
5
by: moddster | last post by:
Hi Guys. I am a newbie to perl and need some help with a problem. PROBLEM: I have to parse an HTML file and get rid of all the HTML tags and count the number of sumbissions a person has through...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.