View Full Version : Access: restrict amount of output from a field

Sep 7th, 2006, 12:39 AM
Hi, I've just been reading this thread - 3 years later! I am trying to include your solution to restricting the amount of characters returned in a query. I use MS Access as my database and wonder if this is why I can't get the code to work? I get the following response:

# Error Type:
Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/soundplay/Templates/testPage.asp, line 559, column 69

The code I'm using is as follows:

This is at the beginning of my .asp page - before the head section

Dim rsRelatedText
Dim rsRelatedText_numRows

limit = 50

Set rsRelatedText = Server.CreateObject("ADODB.Recordset")
rsRelatedText.ActiveConnection = connSpMain
rsRelatedText.Source = "SELECT featureText FROM tblPages WHERE section = 'home' AND categoryLink <> 'index'"
rsRelatedText.CursorType = 0
rsRelatedText.CursorLocation = 2
rsRelatedText.LockType = 1

rsRelatedText_numRows = 0

And then I have this in the body of the .asp page:

If Len(rsRelatedText.Fields("featureText")) > limit then
response.write(server.HTMLEncode(Left(rsRelatedText.Fields("featureText"), limit)) & "...") 'HTMLEncode to display the text as text and not HTML code
end if

Can anyone still help with this issue?

In anticipation,


Sep 7th, 2006, 05:34 PM
As the error message indicates, you are missing an end parenthesis.