Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specific selection from a record 1

Status
Not open for further replies.

michaelacheson

Programmer
Nov 22, 2001
5
GB
Hello,

I have records like the ones below stored in FieldA:

UK 9 591663 998 7
UK 9 4221 1677 6

I want to select the bold section between the space after 9 and the next space. Eg. from these 2 examples I want to select 591663 and 4221 and put them in FieldB. The records will always start with UK 9 but the next section could vary from 1 number to a maximum of 6. After the bold section that I want selected, there will always be a space followed by a random amount of numbers.

Many Thanks,
Michael

 
Here is SQL to parse the field as you requested.
SELECT tblYourTableName.FieldA, Mid$([FieldA],InStr(1,[FieldA],"9")+2,(InStr(InStr(1,[FieldA],"9")+2,[FieldA]," "))-(InStr(1,[FieldA],"9")+2)) AS FieldB
FROM tblYourTableName;

You just have to change the bolded table name to the name of your table.
Bob Scriver
 
Great. Glad to be of assistance. Thanks for the star. Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top