Max Home
max at sherman.org.uk
Mon Jul 31 12:26:51 CDT 2006
Yes, didn't read your string requirements properly - sorry, my fault. Here are 2 alternatives (Using your string example). Hope they help. Regards Max Function DropDoubleVBCRLF() As String Dim str As String str = "Service Order # 67468 On a True 3 Door Prep Table M # TSSU-72-18" & vbCrLf & _ "Invoice Date: 4/27/2006" & vbCrLf & _ "Invoice Total: 105.79" & vbCrLf & _ "Customers Complaint: Replace condensate pan" & vbCrLf & _ "" & vbCrLf & _ "Services/Notes Performed: Install Drain Pan & 3 Clips Tested Ok JB" & vbCrLf & _ "" & vbCrLf & vbCrLf & vbCrLf & vbCrLf MsgBox str & vbCrLf & Len(str) GoTo Option2 'or option1? Option1: ' Option 1 - remove all repeating doubles of vbcrlf Do While InStr(str, vbCrLf & vbCrLf) > 0 str = Replace(str, vbCrLf & vbCrLf, vbCrLf) Loop str = Left(str, (InStrRev(str, vbCrLf) - 1)) MsgBox str & vbCrLf & Len(str) GoTo done Option2: ' Option 2 - keeps embedded double of vbcrlf and trims the end. str = Trim(str) Do While Right(str, 2) = vbCrLf str = Left(str, InStrRev(str, vbCrLf) - 1) Loop MsgBox str & vbCrLf & Len(str) done: DropDoubleVBCRLF = str End Function -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Monday, July 31, 2006 8:10 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Remove mulipule vbCrlf From the end of a string? On 31 Jul 2006 at 7:24, Max Home wrote: > > str = Left(str, (InStr(str, vbCrLf) - 1)) > The sample has multiple vbCrLfs embedded. This would truncate it at "Service Order # 67468 On a True 3 Door Prep Table M # TSSU-72-18" > Regards > Max > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Robert > Sent: Sunday, July 30, 2006 11:37 PM > To: 'Access Developers discussion and problem solving' > Subject: [AccessD] Remove mulipule vbCrlf From the end of a string? > > > Does anyone have a procedure handy to Remove multiple vbCrlf From the end > of a string? > > String Example: > > Service Order # 67468 On a True 3 Door Prep Table M # TSSU-72-18 > Invoice Date: 4/27/2006 > Invoice Total: 105.79 > Customers Complaint: Replace condensate pan > > Services/Notes Performed: Install Drain Pan & 3 Clips Tested Ok JB > > Remove vbCrlf here > Remove vbCrlf here > Remove vbCrlf here > Remove vbCrlf here > > Thanks > Robert > > -- > 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 -- Stuart McLachlan -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com