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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deconstruct a single field to multiple fields

Status
Not open for further replies.

Stargrove

Technical User
Feb 3, 2003
8
US
I have a field with text formatted as follows:

RACK 00150/BAY A/UNIT 01

I would like to create a function or something of the like that would decontstruct that field and place the five digit rack number into a field. Also it should take out the letter after the word BAY (never more than a single letter)and the two digit number (never more than two digits) after the word unit and combine them into a single field.

Field1: 00150
Field2: A01

I have not done this before so don't really know where to start. Thanks in advance.

James
 
Look into some string functions like Left() and Mid().

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
If we call your original field OriginalField (how clever is that?) then if
OriginalField = "RACK 00150/BAY A/UNIT 01"

Field1 = Mid(OriginalField,6,5) 'Yields 00150

Field2 = Mid(OriginalField,16,1) & Right(OriginalField,2) 'Yields A01


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
I would probably use the Split function to do the initial splitting into 3 fields (Split would create an array with 3 elements), then use Mid or Left functions to extract the strings I want.

 
Thanks to all who replied, I will give these ideas a shot this morning.

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top