PDA

View Full Version : trimming a record from access database


Baleric
08-21-2006, 12:24 AM
hey guys,
just wondering how you trim down a record from the database to show only 100 character and then has ...
i got a news page and i would like to make the front page to show only a fraction of the page so you then have to click more to see the rest.

cheers

baleric

mehere
08-21-2006, 02:10 AM
try this:

Function CropStringAt(strString, iLettersAmount)
Dim result, x, curChar
result = Left(strString, iLettersAmount)
x = iLettersAmount+1
Do Until x>Len(strString)
curChar = Mid(strString, x, 1)
If (curChar=" ") Or (curChar=",") Or (curChar="-") Or (curChar="(") Or _
(curChar=")") Or (curChar="[") Or (curChar="]") Then Exit Do
result = result & curChar
x = x+1
Loop
CropStringAt = result&"..."
End Function

then to use it ...
Response.Write(CropStringAt(mystring, 100))

Baleric
08-21-2006, 02:31 AM
thanks mate,
worked perfect!!