[AccessD] A2003:Replacing 'tokens' in a string

Max Wanadoo max.wanadoo at gmail.com
Wed Jan 27 23:54:10 CST 2010


Yes John/Drew but why use that horrendous code when you can do the same with
this..

Call
xsplit("[AccountNo]=1234,[InvoiceNo]=1234567,[InvoiceDate]=04/01/2010,[Name]
=Barry")

Function xSplit(str as string)
    Dim arr() As String, i As Integer
    arr = Split(str, ",")
    Debug.Print arr(0), arr(1), arr(2), arr(3) 'Done!
	'if you want the values then this next bit will do that
    For i = 0 To 3
        arr(i) = Mid(arr(i), InStr(arr(i), "=") + 1)
        Debug.Print arr(i),
    Next i
End Function

A person cannot go through life taking the more obtuse form of coding just
so that they may "learn" something new.
It is all about getting the code out.
I am with Stuart on  this.

Max


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: 28 January 2010 02:02
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2003:Replacing 'tokens' in a string

LOL

Stuart, I think you misunderstand.  We all recommend that you do the minimum
amount of work 
necessary and stay ignorant the rest of your life.  It has worked for me for
all these many years. 
Why in the world would you want to take an opportunity and actually LEARN
something?

;)

John W. Colby
www.ColbyConsulting.com


Stuart McLachlan wrote:
> At last! someone else who does it with a few lines of simple code rather
than vastly over-
> engineering the solution :-)
> 
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list