Marcus, Scott (GEAE, RHI Consulting)
scott.marcus at ae.ge.com
Tue Feb 4 09:26:00 CST 2003
Here is an all purpose function that returns 0 if the string doesn't contain what you are looking for... and the position of the last occurance otherwise. Watch for line wrap... Public Function LastOccurance(strSearch as String, strFind as String) as Integer Dim intLastOccurance as Integer Dim intPosition as Integer intLastOccurance = 0 intPosition = Instr(1, strSearch, strFind) While intPosition > 0 intLastLastOccurance = intPosition intPosition = Instr(intPosition, strStart, " ") Wend LastOccurance = intLastOccurance End Function Scott Marcus -----Original Message----- From: Bryan Carbonnell [mailto:carbonnb at sympatico.ca] Sent: Tuesday, February 04, 2003 9:37 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Parsing Strings-UPDATE On 4 Feb 2003 at 8:19, Terri Jarus wrote: > This was exactly what I needed. However, InStrRev is not available in > 97 - I have both 97 and XP, so was able to extract what I needed. How > would it work for 97 though?? Terri, You would have to loop through the string one character at a time, backwards to find the space and then parse it, something like: For lngLoop = Len(strStart) To 1 Step -1 If Mid$(strStart, lngLoop, 1) = " " Then 'We have the space so exit the loop Exit For End If Next strOut = Mid$(strStart, lngLoop + 1) -- Bryan Carbonnell - carbonnb at sympatico.ca Experience is a wonderful thing. It enables you to recognize a mistake when you make it again. _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com