snyperj
asked on
Help with a query to pull data from within a string
I have an imported table that has 1 data field ('name') with the following records
American Stairs (AMS)
CherryWood (CHW)
DoRay Furnishings (DRN)
In a query, I need to separate the 3 character designation out from between the parenthesis... how can I do that in a query please?
The parenthesis always start 1 space after the name, and the designation is always three characters long (i.e. AMS, CHW)
Thanks
American Stairs (AMS)
CherryWood (CHW)
DoRay Furnishings (DRN)
In a query, I need to separate the 3 character designation out from between the parenthesis... how can I do that in a query please?
The parenthesis always start 1 space after the name, and the designation is always three characters long (i.e. AMS, CHW)
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this will handle more than 3 letters in the parentheses
select Trim (Replace(Replace(Mid([Name ], InStr([Name], "(")), "(", ""), ")", ""))
from tablex
select Trim (Replace(Replace(Mid([Name
from tablex
And a second look at mine and realised it will not work, should have been
SELECT Mid(name, Instring(name, "(") + 1, 3)
And the minimum code:
NME: Left(Right([FieldName],4), 3)
/gustav
NME: Left(Right([FieldName],4),
/gustav
ASKER
thanks to all, but this was first and all I needed
Open in new window
You may be better to just get the name from the database and then extract the 3 character designation