View Full Version : Extracting info from within a field


Domestos
03-24-2010, 08:50 AM
Hi everyone, This is probably quite easy to a seasoned pro - but ive had a good look round the net and these forums but cannot find a similar problem that has been resolved that I could reuse. Hopefully you would be kind enough to take some time and help me out.

Basically I need to extract a value (number) from within a field. lets say I have a linked table to an external data source (e-mail), and one of the links columns within this table is called Contents.

I want to be able to extract a value from this column I have got so far but the syntax is really beyond me... Basically the text in this source field is.

The component successfully processed an event on: 23/03/2010 06:51:21
NOTE: This message indicates a successfull resolution to the previous 1 Alert(s)


I want to be able to extract the value "1" in the above example from within this source text - however this could be any number upto and including 999

Put simply I need some code that will extract the value between the words "previous" and "Alert(s)" no mater the size and turn it into a value that I can use to calculate elsehere within the form.

Hopefully - TIA.

vbaInet
03-25-2010, 11:55 AM
These come to mind:

Mid(), InStrRev(), "previous", the number 9, and Val()

However, there must be a field that already contains that number isn't there?

Welcome to AWF by the way :)