By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,775 Members | 1,425 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,775 IT Pros & Developers. It's quick & easy.

Parsing data from a text field

P: n/a
AJ
I am not much of a programmer, and have been given a database, withwhich to
make some reports.
How would I parse specific numbers from a field that has

Value: 45 Name: RegFee, Value: -3 Name: RegFee, Value: 265 Name: RegProg,
Value: -5 Name: CSSAMem

....all in one field.

I am trying to pull a figure from name/value pair into a separate report
field, so I can sum and check totals, etc. Maybe have 4 or 5 different
fields that will all try to parse something different.

Thanks in advance.

- aj
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"AJ" <ne**@comunity.net> wrote in message
news:Q_ape.1591532$6l.18892@pd7tw2no...
I am not much of a programmer, and have been given a database, withwhich to make some reports.
How would I parse specific numbers from a field that has

Value: 45 Name: RegFee, Value: -3 Name: RegFee, Value: 265 Name: RegProg,
Value: -5 Name: CSSAMem

...all in one field. What - all of that text shown above is in one field - or just the "Value: 45
Name: RegFee," parts in each?

I am trying to pull a figure from name/value pair into a separate report
field, so I can sum and check totals, etc. Maybe have 4 or 5 different
fields that will all try to parse something different.


Well - I suppose where you eventually want to output the answers can be
dealt with after you've successfully parsed out the information you want.
:-)

Either way I'd say you'd be well off making the InStr function your good
friend (hmm along with len and probably mid and do/until) :-)
You'd use it to look for "Name" or "Value" in your main text string -
examine the text after that until you encounter a comma (I presume just from
looking at it what's there) and then start from that point searching again.
Have a little look and play - and just ask if you need something a little
more concrete :-)
BFN
Nov 13 '05 #2

P: n/a
The other function you may want to look at is Split. Hopefully, the
first pair's missing comma is just a typo. If so, you could split your
data into an array, and then split those again. Read up on split in
the VB Help and play with it a little. If you can read the separate
variable/value pairs into an array (and the format is consistent), you
can create a simple rule to split the two and write them to separate
fields in your table. (for that see recordsets and .AddNew)

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.