monicaroman
New member
- Local time
- Today, 17:31
- Joined
- Jan 5, 2011
- Messages
- 4
Hello,
I need to write a query that tells me who has spaces before their names and after, and when there are two names in the field, who has more than one space.
-The fields are Firstname, MiddleInitial, and LastName
-The data for all of them can look like(using _for spaces):
_Jim_Bob
Jim_Bob__
Jim_Bob
Jim__Bob
_J_Bob__
including in some cases _Jim_Bob_II
I have a query that gives me everyone with a leading or trailing spaces, but also all those with spaces in the middle. For those with spaces in the middle, I only want to know if there are more than one space.
This is the query:
SELECT [Employees].FirstName, [Employees].MiddleInitial, [Employees].LastName
FROM [Employees]
WHERE (((InStr([FirstName]," "))>0)) OR (((InStr([LastName]," "))>0)) OR (((InStr([MiddleInitial]," "))>0)) OR ((([Employees].LastName) Is Null)) OR ((([Employees].FirstName) Is Null))
ORDER BY [Employees].FirstName;
I read a lot about Trim, Mid, Len, Left, Right, etc., and I'm utterly confused, but I also think that I don't need that in this case as I only want to show who has extra spaces.
Please help!
Thanks so much.
I need to write a query that tells me who has spaces before their names and after, and when there are two names in the field, who has more than one space.
-The fields are Firstname, MiddleInitial, and LastName
-The data for all of them can look like(using _for spaces):
_Jim_Bob
Jim_Bob__
Jim_Bob
Jim__Bob
_J_Bob__
including in some cases _Jim_Bob_II
I have a query that gives me everyone with a leading or trailing spaces, but also all those with spaces in the middle. For those with spaces in the middle, I only want to know if there are more than one space.
This is the query:
SELECT [Employees].FirstName, [Employees].MiddleInitial, [Employees].LastName
FROM [Employees]
WHERE (((InStr([FirstName]," "))>0)) OR (((InStr([LastName]," "))>0)) OR (((InStr([MiddleInitial]," "))>0)) OR ((([Employees].LastName) Is Null)) OR ((([Employees].FirstName) Is Null))
ORDER BY [Employees].FirstName;
I read a lot about Trim, Mid, Len, Left, Right, etc., and I'm utterly confused, but I also think that I don't need that in this case as I only want to show who has extra spaces.
Please help!
Thanks so much.