Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Parsing data from a text field

2 views
Skip to first unread message

AJ

unread,
Jun 7, 2005, 2:18:24 AM6/7/05
to
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


LeighP

unread,
Jun 7, 2005, 6:42:15 AM6/7/05
to

"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


pietl...@hotmail.com

unread,
Jun 7, 2005, 11:10:26 AM6/7/05
to
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)

0 new messages