Mackin, Christopher
CMackin at quiznos.com
Thu Jan 13 14:48:22 CST 2005
Take the Left(strVariable, 40) and then use the InStrRev function to find the first space from the end looking back: strTmp = Left(strVariable, 40) intPos = InStrRev(strTmp, " ") strLine1 = Left(strVariable, intPos - 1) strLine2 = Mid(strVariable, intPos + 1) That will find the first space from 40 back and then split the line into two based on the location of the space. -Chris Mackin -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Mitsules, Mark Sent: Thursday, January 13, 2005 1:42 PM To: [AccessD] Subject: [AccessD] Parsing String Group, I have a large recordset of strings that need to be split up by length, maximum of 53 characters per line, not to exceed 2 lines. The issue I am struggling with is maintaining logical word breaks. For instance, here is an example string (watch for line wrap): VENTILATION CONNECTION UNDER 1ST, 2ND & 3RD PLATFORM, FR 37-39 - HANGER DETAILS MANUFACTURING Can anyone suggest a good routine to accomplish this? Here are my first thoughts... I would like to take any line over 40 characters and split it into 2 lines, so the pseudocode might be something like: If len(strTitle) > 40, Then starting point is at the halfway point If at a space, then make the break here Else count number of characters forward to a space count number of characters backward to a space make the break at the lower of the two End If End If Thanks for any suggestions. Mark -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com