473,385 Members | 2,028 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.

adding middle initial field

180 100+
I want to add the middle initial field in contacts extended query.
Expand|Select|Wrap|Line Numbers
  1. File As: IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First Name]),IIf(IsNull([First Name]),[Last Name],[Last Name] & ", " & [First Name]))
where can i put [middle initial] so that when i view the report the complete name will appear. ex. Juan c. Dela Cruz
Jan 12 '12 #1

✓ answered by NeoPa

eneyardi:
it became like this: Juan C.. Dela Cruz
That tells me that your [Middle Initial] field has been populated with (includes) the period. This is not good design. The period is not (should not be) part of the data.

NeoPa:
Assuming you want to display the optional [First Name], followed by the optional [Middle Initial] followed by the mandatory [Last Name], you could try :
Expand|Select|Wrap|Line Numbers
  1. Contact Name: ([First Name] + ' ') & ([Middle Initial] & '. ') & [Last Name]
See Using "&" and "+" in WHERE Clause for more on how this works.
The best idea is to fix your data. However, while the data is still broken simply use the following instead :
Expand|Select|Wrap|Line Numbers
  1. Contact Name: ([First Name] + ' ') & ([Middle Initial] & ' ') & [Last Name]

8 2946
eneyardi
180 100+
it works, I only add after [first name]&" "&[Middle Initial]&" "&[last Name]
Expand|Select|Wrap|Line Numbers
  1. Contact Name: IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[Company],[First Name]),IIf(IsNull([First Name]),[Last Name],[First Name] &" " & [Middle Initial] & " "  & [Last Name]))
Jan 12 '12 #2
sierra7
446 Expert 256MB
Hi,
You seem to have fixed this to your satisfaction but you will always have two spaces between first and lastname.

In your example you had a fullstop (dot, punto, período) after the middle initial, so you may want to do something like ;-

Expand|Select|Wrap|Line Numbers
  1.  .....
  2. ,[first name]& IIF(IsNull[Middle Initial]," "," " & [Middle Initial] & ". ") & [Last Name].....
  3.  
S7
Jan 12 '12 #3
NeoPa
32,556 Expert Mod 16PB
Firstly, Please read the PM I sent carefully. It may be your final warning. Any discussion of such must be via PM.

As for your question, I will ignore the [Company] field as the logic for that isn't explained anywhere, but assuming you want to display the optional [First Name], followed by the optional [Middle Initial] followed by the mandatory [Last Name], you could try :
Expand|Select|Wrap|Line Numbers
  1. Contact Name: ([First Name] + ' ') & ([Middle Initial] & '. ') & [Last Name]
See Using "&" and "+" in WHERE Clause for more on how this works.
Jan 12 '12 #4
eneyardi
180 100+
Thanks sierra7, thanks neopa. sorry again, i thought it doesn't need to be tag.
Jan 13 '12 #5
eneyardi
180 100+
it became double period the middle initial after i used your code neopa

Expand|Select|Wrap|Line Numbers
  1. Contact Name: ([First Name] + ' ') & ([Middle Initial] & '. ') & [Last Name]
it became like this: Juan C.. Dela Cruz
Jan 13 '12 #6
NeoPa
32,556 Expert Mod 16PB
eneyardi:
it became like this: Juan C.. Dela Cruz
That tells me that your [Middle Initial] field has been populated with (includes) the period. This is not good design. The period is not (should not be) part of the data.

NeoPa:
Assuming you want to display the optional [First Name], followed by the optional [Middle Initial] followed by the mandatory [Last Name], you could try :
Expand|Select|Wrap|Line Numbers
  1. Contact Name: ([First Name] + ' ') & ([Middle Initial] & '. ') & [Last Name]
See Using "&" and "+" in WHERE Clause for more on how this works.
The best idea is to fix your data. However, while the data is still broken simply use the following instead :
Expand|Select|Wrap|Line Numbers
  1. Contact Name: ([First Name] + ' ') & ([Middle Initial] & ' ') & [Last Name]
Jan 13 '12 #7
eneyardi
180 100+
Thanks Neopa, i fixed my data not to include period.
Jan 16 '12 #8
NeoPa
32,556 Expert Mod 16PB
That's very sensible :-) You seem to be learning since you've been using Bytes.
Jan 16 '12 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: M. Bader | last post by:
Hi, i'm struggling with updating session expire times in my login table. Can you tell me, how to correctly add an amount of seconds (after that the session expires) to a datetime field? ...
1
by: Tony D. | last post by:
I could really use some help with a problem I am having. I am trying to add a new field to an existing form that combines two tables into one form. In this same databse I have another form that...
2
by: Randy A. Bohannon | last post by:
This is probably a simple thing to do, but I can't find how in the help files or the manual I have. I'm using Access 2000. I have three tables joined by a common field, and I'm using one form...
1
by: alfred | last post by:
Hi What is the type of a memo field and a long integer. ex. double = adDouble, currency = adCurrency etc. text = advarwchar Set col16 = Nothing: Set col16 = New ADOX.Column With col16...
1
by: Maziar Aflatoun | last post by:
Hi everyone, I have the following code and I like to add a hidden field in each row <asp:datagrid id="DataGrid1" style="Z-INDEX: 102; LEFT: 48px; POSITION: absolute; TOP: 40px" runat="server"...
4
by: bpneary1 | last post by:
First of all, I want to thank everyone who posts messages in this group. I am very new to VB and developing full-blown database apps, and I have learned a great deal by reading these posts, so I...
3
by: tomlebold | last post by:
Look for query that changes Tom L LeBold into Tom LeBold and only when the middle intial exist.
0
geo039
by: geo039 | last post by:
I have a gridview with add functionality embedded in the footer row. My problem is I have an id field in the table that is foreign to another table since I cannot add a record with this id field as a...
2
AaronL
by: AaronL | last post by:
Hi guys, I just started to learn MySql and php and am relatively new to how databases work. I setup my database and wrote the following code and I get the error: ...
2
by: lenora | last post by:
Im trying to Separate Last name, First Name and Middle Initial. File is csv format, here is an example: A0001,3,Y,13,LU, A0001,3,Y,13,CLARK P, A0001,3,Y,13,SMITH JOHN, A0001,3,Y,13,BEAL...
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?
0
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...
0
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...
0
Oralloy
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 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.