2nd & 3rd word in text string

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi

Using Access 2002 I need to be able to identify the 2nd and word in a text
string so that they can be shown seperately on the form.

Does anyone have some examples to achieve this please.

TIA

Tom
 
Place the following code in a standard code module

Public Function getToken(v As Variant, intToken As Integer) As Variant

On Error Resume Next
If IsNull(v) = False Then
getToken = Split(v, " ")(intToken - 1)
End If


End Function

Now, you can place a text box on the form (or even a report), and set the
datasource to:

=GetToken([NameOfField],2)

And for the other text box, go:

=GetToken([NameOfField],3)
 
Back
Top