Isolating text in a field

S

scubadiver

Hi folks!

The following text is an example:

"F002 Internal Audit Summary Report Form Rev B.doc"

How do I isolate "Rev B" considering that everything that comes before isn't
necessarily the same length in each record.

Cheers!
 
M

Michel Walsh

You can use the VBA function InStr( ), see the help file, to spot the
beginning of "Rev B" and then, use Left( ), or Mid( ), to segment the
strings in its parts:




Left( MyField & "Rev B", InStr( MyField & "Rev B" , "Rev B") - 1 )


will give what precedes the first occurrence of Rev B, in your string, or
the whole string, if Rev B is absent.



Hoping it may help,
Vanderghast, Access MVP
 
Top