matt beamish
Registered User.
- Local time
- Today, 22:54
- Joined
- Sep 21, 2000
- Messages
- 215
Hi all,
long time no see from me as my job changed a bit, and I'm not doing anything near the amount of VBA I used to do. So apologies, but I am just a bit rusty and would appreciate a hand.
I need to split a field that is consistently delimited by commas, and contains numeric strings between the commas. which I need to append into another table along with another field.
I have incorporated Allen Browne's ParseWord function
Parseword()
into a db, and by using this in a query, and then applying the Int() function
Int()
to the results, I get what I need.
However, Allen Brownes adaptation of Split() requires the position of the string to be extracted from the overall string ("ByVal iWordNum As Integer") but I need to loop through the complete string and break all the data into chunks. In the query I have am needing to specify postion 1, position 2, position 3 etc for the outputs, but this means guessing the number of postential outputs, and the number of values separated by commas in the field Description is not constained.
Here is some example data as an input, and the output I need
Input
Dwg Description
3.13 Posthole [590]
3.14 Posthole [590]
3.15 Relationship of ditch [600], ditch [598], ditch [596]
3.16 Relationship of ditch [600], ditch [598], ditch [596]
Output
Dwg Context
3.13 590
3.14 590
3.15 600
3.15 598
3.15 596
3.16 600
3.16 598
3.16 596
So I need to adapt the ParseWord() or Split() function to loop through all my data, with all the extracted values in one column. Might anyone help me with this please? I always struggled with loops
thanks
long time no see from me as my job changed a bit, and I'm not doing anything near the amount of VBA I used to do. So apologies, but I am just a bit rusty and would appreciate a hand.
I need to split a field that is consistently delimited by commas, and contains numeric strings between the commas. which I need to append into another table along with another field.
I have incorporated Allen Browne's ParseWord function
Parseword()
into a db, and by using this in a query, and then applying the Int() function
Int()
to the results, I get what I need.
However, Allen Brownes adaptation of Split() requires the position of the string to be extracted from the overall string ("ByVal iWordNum As Integer") but I need to loop through the complete string and break all the data into chunks. In the query I have am needing to specify postion 1, position 2, position 3 etc for the outputs, but this means guessing the number of postential outputs, and the number of values separated by commas in the field Description is not constained.
Here is some example data as an input, and the output I need
Input
Dwg Description
3.13 Posthole [590]
3.14 Posthole [590]
3.15 Relationship of ditch [600], ditch [598], ditch [596]
3.16 Relationship of ditch [600], ditch [598], ditch [596]
Output
Dwg Context
3.13 590
3.14 590
3.15 600
3.15 598
3.15 596
3.16 600
3.16 598
3.16 596
So I need to adapt the ParseWord() or Split() function to loop through all my data, with all the extracted values in one column. Might anyone help me with this please? I always struggled with loops
thanks