Stuart McLachlan
stuart at lexacorp.com.pg
Wed Jan 27 18:40:53 CST 2010
At last! someone else who does it with a few lines of simple code rather than vastly over- engineering the solution :-) -- Stuart On 27 Jan 2010 at 16:08, Kevin wrote: > 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 >