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

Darren - Active Billing darren at activebilling.com.au
Wed Jan 27 19:35:16 CST 2010


Hi Kevin

Thanks for this - I'll look into this to see how I can fit it in 

- Thanks again
 
Darren 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kevin
Sent: Thursday, 28 January 2010 11:08 AM
To: 'Access Developers discussion and problem solving'
Cc: darren at activebilling.com.au
Subject: Re: [AccessD] A2003:Replacing 'tokens' in a string

Darren,

Try this...

Function FindString(str As String) As Variant
    Dim strNew                                    As String
    strNew = Mid(str, InStr(1, str, "InvoiceNo]="), Len(str) - InStr(1, str,
"InvoiceNo]="))
    strNew = Right(strNew, Len(strNew) - 11)
    FindString = Left(strNew, InStr(1, strNew, "'") - 1)
End Function

Kevin Waddle
thewaddles at sbcglobal.net

All that I have seen teaches me to trust God for all I have not seen. 
~Author Unknown
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren - Active
Billing
Sent: Tuesday, January 26, 2010 6:32 PM
To: AccessD
Subject: [AccessD] A2003:Replacing 'tokens' in a string

Hi team

Assuming the string below

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

How would I get just the Invoice Number bit = Eg 1234567?

The 'token' [InvoiceNo] will be constant followed by an "=" sign

But sadly the position of the [InvoiceNo] token in the string will not be
constant - Otherwise I'd just use MID()

Nor will the length of the invoice number - Some may be 4 digits others 6
etc

I need to pull just the Invoice Number (And the Account Number) out of the
string to build a new string being used elsewhere

Many thanks in advance

Darren

 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
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