I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike 11 8366
Left(PersonsWholeName ,Instr(PersonsWholeName," "))
Searches for the first space
Phil
"magmike" <ma******@yahoo.comwrote in message
news:11**********************@g4g2000hsf.googlegro ups.com...
>I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike
magmike <ma******@yahoo.comwrote in news:1191877329.697545.220570
@g4g2000hsf.googlegroups.com:
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike
Use the instr() function to find the first space, subtract 1, test for
negative value and pass this to the left() function
FirstName: left(Fullname,abs(instr(Fullname," ")-1))
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account from http://www.teranews.com
On Oct 8, 4:02 pm, magmike <magmi...@yahoo.comwrote:
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike
Assuming that the first name is always last, and that it is separated
with a space, and that it will never have any trailing spaces, then
use instrRev( ) to locate the last space. Your first name will start
in the next position.
sFirstName=mid(instrRev("Smith, John"," ")+1)
On Oct 8, 3:48 pm, Bob Quintal <rquin...@sPAmpatico.cawrote:
magmike <magmi...@yahoo.comwrote in news:1191877329.697545.220570
@g4g2000hsf.googlegroups.com:
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike
Use the instr() function to find the first space, subtract 1, test for
negative value and pass this to the left() function
FirstName: left(Fullname,abs(instr(Fullname," ")-1))
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account fromhttp://www.teranews.com
and what is the abs for ?
On Oct 8, 5:02 pm, magmike <magmi...@yahoo.comwrote:
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike
If you are using Access>=2000 you might try:
Split(EntireName)(0)
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Mea culpa. I misread you initial statement thinking your names were
last name, comma, space, first name format. Bob's example should work
fine without the ABS( ) unless there is an accidental space before the
first name (this happens occasionally) or there is no space at all, in
which case you would get an nasty error message.
When I have time, I am going to seperate the name field out by first,
middle, last, suffix, etc. I also like to add a field for
pronunciation, and a "Go By" field, for when some guy named george
goes by Skip, or Scooter. That way, when you have a first name like
Mary Ann, or a last name like Van Damme, you don't have to worry about
how the left thing will come out. But, I inherited this thing and
needed a temporary fix until that can happen.
On Oct 12, 11:06 am, lyle <lyle.fairfi...@gmail.comwrote:
On Oct 8, 5:02 pm, magmike <magmi...@yahoo.comwrote:
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike
If you are using Access>=2000 you might try:
Split(EntireName)(0)
How does that come out? How does it effect double first names (like
Mary Ann), double last names (like Van Damme), hyphenated last names
(like Evans-Schelske), the presence of middle names and/or initialed
names (like P. Thomas Jenkins or Alfred E. Newman)?
mike
On Oct 12, 11:06 am, lyle <lyle.fairfi...@gmail.comwrote:
On Oct 8, 5:02 pm, magmike <magmi...@yahoo.comwrote:
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike
If you are using Access>=2000 you might try:
Split(EntireName)(0)
And... how would I use that? What is the output? I don't think I could
use that as a query field. Is that some sort of special query that
creates a table or just gives specialized results of a table?
On Oct 12, 10:31 am, magmike <magmi...@yahoo.comwrote:
On Oct 8, 3:48 pm, Bob Quintal <rquin...@sPAmpatico.cawrote:
magmike <magmi...@yahoo.comwrote in news:1191877329.697545.220570
@g4g2000hsf.googlegroups.com:
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Many, many thanks!
mike
Use the instr() function to find the first space, subtract 1, test for
negative value and pass this to the left() function
FirstName: left(Fullname,abs(instr(Fullname," ")-1))
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account fromhttp://www.teranews.com
and what is the abs for ?
If there is no space at all in the field, instr() returns 0,
from which we are removing 1. In that case the -1
result will trigger an error message from left(). The abs() converts -
1 to +1,which will return the space or first initial, a better choice
in my opinion, than an error message.
One could move the code into a user-defined function where one could
build more sophisticated error checking and correction, but this is
quick, dirty and works.
On Oct 12, 12:11 pm, OldPro <rrossk...@sbcglobal.netwrote:
I am trying to use this with a name field that has the entire name in
one field in a report that is actually a letter. In the letter, of
course, I need to address the recipient by first name in the greeting
line. Can I create a statement to use only the left-most word instead
of stating how many characters?
Mea culpa. I misread you initial statement thinking your names were
last name, comma, space, first name format. Bob's example should work
fine without the ABS( ) unless there is an accidental space before the
first name (this happens occasionally) or there is no space at all, in
which case you would get an nasty error message.
the abs() prevents getting an error message. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: sbligh |
last post by:
Do any of you know if it's possible to get the name of your field from
another table?
E.g.
Select FYear as
I need the name of the fields to be user defined and the only way I
can see this...
|
by: Giles |
last post by:
Is there a way to get records containing a whole word? I've heard regular
expressions can do it, but I can't make one work in an ASP / MS Access SQL
Query
sSQL="SELECT PageTitle FROM Pages WHERE...
|
by: Alberto |
last post by:
Eh unfortunately Google groups does not provide any longer a way to
reply to the group for older posts (though the one I am referring to is
not older than one month), and I happen to come back to...
|
by: shonend |
last post by:
I am trying to extract the pattern like this :
"SUB: some text LOT: one-word"
Described, "SUB" and "LOT" are key words; I want those words,
everything in between and one word following the...
|
by: seannakasone |
last post by:
Is there a way to search a string for a whole word w/o using a regular
expression?
i.e.
mystring.IndexOf(mypattern, *WholeWord);
The reason i rather not use a regular expression is because...
|
by: Buddhist[CHinA] |
last post by:
I mean I wanna search a string in certain text files. But I don't know how
to effectively get a whole-word match result.
Can someone do me a favor?
thx.
|
by: Michael Yanowitz |
last post by:
Hello:
I am hoping someone knows if there is an easier way to do this or someone
already implemented something that does this, rather than reinventing the
wheel:
I have been using the...
|
by: nico3334 |
last post by:
I currently have a query that Joins 2 Tables (Table1 and Table2) using
LEFT OUTER JOIN. Here is an example of that query:
SELECT a.supply,
a.state,
b.cost
FROM Table1 a
LEFT...
|
by: Peng Yu |
last post by:
Hi,
The following code snippet is from /usr/bin/rpl. I would like the it
to match a word, for example, "abc" in ":abc:". But the current one
would not match "abc" in ":abc:". I tried to modify...
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |