473,487 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

concatenating problem when hyphenated first name

I have a student who has a hyphenated first name. If I concatenate the
name like this: StudentName:([StudentLastName] & ", " &
[StudentFirstName]), it works as expected. If, however, I try to get
the first name first by concatenating like this: StudentName:
([StudentFirstName] & " " & [StudentLastName]), only the first name
appears.

I sure would appreciate any help!

Mary

Mar 13 '07 #1
7 2758
It should work either way.

Do you have any Criteria in this query? There are known problems with
criteria that contains a dash:
http://support.microsoft.com/kb/271661/en-us

What language are you using?
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mary" <mm**********@msn.comwrote in message
news:11**********************@v33g2000cwv.googlegr oups.com...
>I have a student who has a hyphenated first name. If I concatenate the
name like this: StudentName:([StudentLastName] & ", " &
[StudentFirstName]), it works as expected. If, however, I try to get
the first name first by concatenating like this: StudentName:
([StudentFirstName] & " " & [StudentLastName]), only the first name
appears.

I sure would appreciate any help!

Mary
Mar 13 '07 #2
On Mar 13, 10:11 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
It should work either way.

Do you have any Criteria in this query? There are known problems with
criteria that contains a dash:
http://support.microsoft.com/kb/271661/en-us

What language are you using?

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mary" <mmcgilliv...@msn.comwrote in message

news:11**********************@v33g2000cwv.googlegr oups.com...
I have a student who has a hyphenated first name. If I concatenate the
name like this: StudentName:([StudentLastName] & ", " &
[StudentFirstName]), it works as expected. If, however, I try to get
the first name first by concatenating like this: StudentName:
([StudentFirstName] & " " & [StudentLastName]), only the first name
appears.
I sure would appreciate any help!
Mary- Hide quoted text -

- Show quoted text -
No, I have no criteria in the query. I get the same results if I
create a query that only lists these fileds.

I am using Access 2003.

Mar 13 '07 #3
Switch the query to SQL View (View menu, from query design.)

Paste the SQL statement here.

I can't understand what's wrong, because I do this kind of thing all the
time.

What language setting do you have under:
Tools | Options | General | New database sort order

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Mary" <mm**********@msn.comwrote in message
news:11**********************@c51g2000cwc.googlegr oups.com...
On Mar 13, 10:11 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
>It should work either way.

Do you have any Criteria in this query? There are known problems with
criteria that contains a dash:
http://support.microsoft.com/kb/271661/en-us

What language are you using?

"Mary" <mmcgilliv...@msn.comwrote in message

news:11**********************@v33g2000cwv.googleg roups.com...
>I have a student who has a hyphenated first name. If I concatenate the
name like this: StudentName:([StudentLastName] & ", " &
[StudentFirstName]), it works as expected. If, however, I try to get
the first name first by concatenating like this: StudentName:
([StudentFirstName] & " " & [StudentLastName]), only the first name
appears.
I sure would appreciate any help!
Mary- Hide quoted text -

- Show quoted text -

No, I have no criteria in the query. I get the same results if I
create a query that only lists these fileds.

I am using Access 2003.
Mar 13 '07 #4
On Mar 13, 11:10 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
Switch the query to SQL View (View menu, from query design.)

Paste the SQL statement here.

I can't understand what's wrong, because I do this kind of thing all the
time.

What language setting do you have under:
Tools | Options | General | New database sort order

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org."Mary" <mmcgilliv...@msn.comwrote in message

news:11**********************@c51g2000cwc.googlegr oups.com...
On Mar 13, 10:11 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
It should work either way.
Do you have any Criteria in this query? There are known problems with
criteria that contains a dash:
http://support.microsoft.com/kb/271661/en-us
What language are you using?
"Mary" <mmcgilliv...@msn.comwrote in message
>news:11**********************@v33g2000cwv.googleg roups.com...
I have a student who has a hyphenated first name. If I concatenate the
name like this: StudentName:([StudentLastName] & ", " &
[StudentFirstName]), it works as expected. If, however, I try to get
the first name first by concatenating like this: StudentName:
([StudentFirstName] & " " & [StudentLastName]), only the first name
appears.
I sure would appreciate any help!
Mary- Hide quoted text -
- Show quoted text -
No, I have no criteria in the query. I get the same results if I
create a query that only lists these fileds.
I am using Access 2003.- Hide quoted text -

- Show quoted text -
Thanks so much for your help, Allen.

I had an index on the field. I removed the index and retyped the first
name in the table. Now it works. This is so strange. I just realized
that there were other hyphenated first names that concatenated
correctly.

Here is my SQL:

SELECT ([StudentFirstName] & " " & [StudentLastName]) AS StudentName
FROM tblEAStudentInformation;

The language setting under:
Tools | Options | General | New database sort order
is "General"
Mary


Mar 13 '07 #5
I can't see anything wrong with that, Mary.

In the next column in query design, enter:
CharCount: Len([StudentFirstName] & " " & [StudentLastName])

Does it return the expected number of characters (including the space)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mary" <mm**********@msn.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
On Mar 13, 11:10 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
>Switch the query to SQL View (View menu, from query design.)

Paste the SQL statement here.

I can't understand what's wrong, because I do this kind of thing all the
time.

What language setting do you have under:
Tools | Options | General | New database sort order
"Mary" <mmcgilliv...@msn.comwrote in message
>>
news:11**********************@c51g2000cwc.googleg roups.com...
On Mar 13, 10:11 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
It should work either way.
>Do you have any Criteria in this query? There are known problems with
criteria that contains a dash:
http://support.microsoft.com/kb/271661/en-us
>What language are you using?
>"Mary" <mmcgilliv...@msn.comwrote in message
>>news:11**********************@v33g2000cwv.google groups.com...
>I have a student who has a hyphenated first name. If I concatenate
the
name like this: StudentName:([StudentLastName] & ", " &
[StudentFirstName]), it works as expected. If, however, I try to get
the first name first by concatenating like this: StudentName:
([StudentFirstName] & " " & [StudentLastName]), only the first name
appears.
I sure would appreciate any help!
Mary- Hide quoted text -
>- Show quoted text -
No, I have no criteria in the query. I get the same results if I
create a query that only lists these fileds.
I am using Access 2003.- Hide quoted text -

- Show quoted text -

Thanks so much for your help, Allen.

I had an index on the field. I removed the index and retyped the first
name in the table. Now it works. This is so strange. I just realized
that there were other hyphenated first names that concatenated
correctly.

Here is my SQL:

SELECT ([StudentFirstName] & " " & [StudentLastName]) AS StudentName
FROM tblEAStudentInformation;

The language setting under:
Tools | Options | General | New database sort order
is "General"
Mary
Mar 13 '07 #6
On Mar 13, 1:31 pm, "Allen Browne" <AllenBro...@SeeSig.Invalidwrote:
I can't see anything wrong with that, Mary.

In the next column in query design, enter:
CharCount: Len([StudentFirstName] & " " & [StudentLastName])

Does it return the expected number of characters (including the space)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mary" <mmcgilliv...@msn.comwrote in message

news:11**********************@h3g2000cwc.googlegro ups.com...
On Mar 13, 11:10 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
Switch the query to SQL View (View menu, from query design.)
Paste the SQL statement here.
I can't understand what's wrong, because I do this kind of thing all the
time.
What language setting do you have under:
Tools | Options | General | New database sort order

"Mary" <mmcgilliv...@msn.comwrote in message
>news:11**********************@c51g2000cwc.googleg roups.com...
On Mar 13, 10:11 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
It should work either way.
Do you have any Criteria in this query? There are known problems with
criteria that contains a dash:
http://support.microsoft.com/kb/271661/en-us
What language are you using?
"Mary" <mmcgilliv...@msn.comwrote in message
>news:11**********************@v33g2000cwv.googleg roups.com...
I have a student who has a hyphenated first name. If I concatenate
the
name like this: StudentName:([StudentLastName] & ", " &
[StudentFirstName]), it works as expected. If, however, I try to get
the first name first by concatenating like this: StudentName:
([StudentFirstName] & " " & [StudentLastName]), only the first name
appears.
I sure would appreciate any help!
Mary- Hide quoted text -
- Show quoted text -
No, I have no criteria in the query. I get the same results if I
create a query that only lists these fileds.
I am using Access 2003.- Hide quoted text -
- Show quoted text -
Thanks so much for your help, Allen.
I had an index on the field. I removed the index and retyped the first
name in the table. Now it works. This is so strange. I just realized
that there were other hyphenated first names that concatenated
correctly.
Here is my SQL:
SELECT ([StudentFirstName] & " " & [StudentLastName]) AS StudentName
FROM tblEAStudentInformation;
The language setting under:
Tools | Options | General | New database sort order
is "General"
Mary- Hide quoted text -

- Show quoted text -
Allen,

Ok, I finally figured out what happened and now it all makes sense.
And I feel kind of stupid because it has nothing to do with a
hyphenated field at all; that was a poor assumption on my part.

I went to a backup file and looked at the table with this student's
first name. His name is Kevin-Michael. When I placed my cursor at the
end of his name and hit "delete", the name "Michael" appears. The user
apparently entered Michael, changed their mind and entered "Kevin
Michael" without erasing the first Michael. So the concatenating
appeared not to be working since his first name was so long. When I
deleted the field and retyped the name, it obviously fixed the
problem. What I don't get, though, is why all I saw in the table, even
when I expanded the field, was "Kevin-Michael". The field size is only
25 characters.The extra 'Michael" only showed up when I hit the delete
key.

Anyway, thank you for your help. I read these posts often and you are
always so kind.I have learned so much from you and your website.

Mary


Mar 13 '07 #7
Great! Solved.

It's often sometime that makes sense in the end. And it's neat that you can
enlist Access to help you understand what's happening, like the calculated
query field giving the character count, or using TypeName() or the Immediate
Window (Ctrl+G.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mary" <mm**********@msn.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
On Mar 13, 1:31 pm, "Allen Browne" <AllenBro...@SeeSig.Invalidwrote:
>I can't see anything wrong with that, Mary.

In the next column in query design, enter:
CharCount: Len([StudentFirstName] & " " & [StudentLastName])

Does it return the expected number of characters (including the space)?

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mary" <mmcgilliv...@msn.comwrote in message

news:11**********************@h3g2000cwc.googlegr oups.com...
On Mar 13, 11:10 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
Switch the query to SQL View (View menu, from query design.)
>Paste the SQL statement here.
>I can't understand what's wrong, because I do this kind of thing all
the
time.
>What language setting do you have under:
Tools | Options | General | New database sort order

"Mary" <mmcgilliv...@msn.comwrote in message
>>news:11**********************@c51g2000cwc.google groups.com...
On Mar 13, 10:11 am, "Allen Browne" <AllenBro...@SeeSig.Invalid>
wrote:
It should work either way.
>Do you have any Criteria in this query? There are known problems
with
criteria that contains a dash:
http://support.microsoft.com/kb/271661/en-us
>What language are you using?
>"Mary" <mmcgilliv...@msn.comwrote in message
>>news:11**********************@v33g2000cwv.google groups.com...
>I have a student who has a hyphenated first name. If I concatenate
the
name like this: StudentName:([StudentLastName] & ", " &
[StudentFirstName]), it works as expected. If, however, I try to
get
the first name first by concatenating like this: StudentName:
([StudentFirstName] & " " & [StudentLastName]), only the first
name
appears.
I sure would appreciate any help!
Mary- Hide quoted text -
>- Show quoted text -
No, I have no criteria in the query. I get the same results if I
create a query that only lists these fileds.
I am using Access 2003.- Hide quoted text -
>- Show quoted text -
Thanks so much for your help, Allen.
I had an index on the field. I removed the index and retyped the first
name in the table. Now it works. This is so strange. I just realized
that there were other hyphenated first names that concatenated
correctly.
Here is my SQL:
SELECT ([StudentFirstName] & " " & [StudentLastName]) AS StudentName
FROM tblEAStudentInformation;
The language setting under:
Tools | Options | General | New database sort order
is "General"
Mary- Hide quoted text -

- Show quoted text -

Allen,

Ok, I finally figured out what happened and now it all makes sense.
And I feel kind of stupid because it has nothing to do with a
hyphenated field at all; that was a poor assumption on my part.

I went to a backup file and looked at the table with this student's
first name. His name is Kevin-Michael. When I placed my cursor at the
end of his name and hit "delete", the name "Michael" appears. The user
apparently entered Michael, changed their mind and entered "Kevin
Michael" without erasing the first Michael. So the concatenating
appeared not to be working since his first name was so long. When I
deleted the field and retyped the name, it obviously fixed the
problem. What I don't get, though, is why all I saw in the table, even
when I expanded the field, was "Kevin-Michael". The field size is only
25 characters.The extra 'Michael" only showed up when I hit the delete
key.

Anyway, thank you for your help. I read these posts often and you are
always so kind.I have learned so much from you and your website.

Mary

Mar 14 '07 #8

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

Similar topics

6
2256
by: nwheavyw8 | last post by:
I am currently trying to write a simple PHP script that will split an uploading file up into 500kb "chunks", then read and concatenate them back together when accessed for download. I can't seem...
14
5482
by: Larry R Harrison Jr | last post by:
I have designed databases but have never come across any complications due to the ridiculous situation of a hyphenated last name. As a database designer (very junior level) I disdain anything...
16
3033
by: Dixie | last post by:
I have a problem using Dev Ashish's excellent module to concatenate the results of a field from several records into one record. I am using the code to concatenate certain awards onto a...
4
2314
by: Juan | last post by:
Does any one know if there are reported bugs when concatenating strings? When debugging each variable has the correct value but when I try to concatenate them some values are missing (I can´t see...
4
11772
by: Elena | last post by:
Hi, I am filling in a combobox. I would like to concatenate two fields into the data combo box and display "last name, first name" I tried to displaymember = "employee_last_name" & ", " &...
3
7002
by: Peter Michaux | last post by:
Hi, Since I can do this document.defaultView.getComputedStyle(el, null).height; why would I ever want to do this document.defaultView.getComputedStyle(el,...
2
1320
by: newfieskater | last post by:
I have 1 table with multiple fields Unit First Name Last Name # Pets Pet's Name 100 John Jackson 1 Oreo 200 Peter ...
3
1863
by: TheCoder | last post by:
Why does this work: It seems that we're concatenating two literals: std::cout << greeting + name + " Hello " + "There" << std::endl; but if you remove (greeting + name +), it doesn't work ?
2
1592
by: renojim | last post by:
I'm trying to concatenate a half dozen fields from an sql statement into a string, then loading the string in a select list. I can't seem to find a way to keep them 'lined up' - so if, for instance,...
0
7106
marktang
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,...
0
7137
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,...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6846
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...
0
5442
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.