Skip to main content
June 28, 2006
Answered

Pulling only a certain amount of information from access

Hi, I have information in microsoft access that i want to display on a webpage the issue im facing is i only want to display a certain amount of the information from ms access...

for example:
if this is my information in microsoft access;

"The information in ms access that i want to display but its too long."

I only want to display this much;

"The information in ms access"
This topic is closed to new replies. Start a new post to keep the conversation going.
primalx2003Correct answer
Inspiring
June 28, 2006
I found this help from the CF documentation. This might help you with your question. It demonstrates the LEFT function. You can rewrite your code to do just that for now.

<h3>Left Example</h3>

<cfif IsDefined("Form.myText")>
<!--- If len returns 0 (zero), then show error message. --->
<cfif Len(Form.myText)>
<cfif Len(Form.myText) LTE Form.RemoveChars>
<cfoutput><p style="color: red; font-weight: bold">Your string #Form.myText# only has #Len(Form.myText)# characters. You cannot output
the #Form.removeChars# leftmost characters of this string because it is
not long enough.</p></cfoutput>
<cfelse>
<cfoutput><p>Your original string: <strong>#Form.myText#</strong></p>
<p>Your changed string, showing only the <strong>#Form.removeChars#
</strong> leftmost characters:
<strong>#Left(Form.myText, Form.removeChars)#</strong></p>
</cfoutput>
</cfif>
<cfelse>
<p style="color: red; font-weight: bold">Please enter a string of more than 0 (zero) characters.</p>
</cfif>
</cfif>

<form action="<cfoutput>#CGI.ScriptName#</cfoutput>" method="POST">
<p>Type in some text<br />
<input type="Text" name="myText"></p>
<p>How many characters from the left do you want to show?
<select name="RemoveChars">
<option value="1">1
<option value="3" selected>3
<option value="5">5
<option value="7">7
<option value="9">9</select>
<input type="Submit" name="Submit" value="Remove characters"></p>
</form>

Hope it helps..

Sevor Klu

5 replies

June 28, 2006
it works out great, thanks a lot for all your help guys...appreciate it!
Translate
June 28, 2006
Thanks for the help, i'm going to try them out...if anyone knows of any other way of doing this please let me know so i can choose which is the best way for me to implement this feature. Thanks again....
Translate
primalx2003Correct answer
Inspiring
June 28, 2006
I found this help from the CF documentation. This might help you with your question. It demonstrates the LEFT function. You can rewrite your code to do just that for now.

<h3>Left Example</h3>

<cfif IsDefined("Form.myText")>
<!--- If len returns 0 (zero), then show error message. --->
<cfif Len(Form.myText)>
<cfif Len(Form.myText) LTE Form.RemoveChars>
<cfoutput><p style="color: red; font-weight: bold">Your string #Form.myText# only has #Len(Form.myText)# characters. You cannot output
the #Form.removeChars# leftmost characters of this string because it is
not long enough.</p></cfoutput>
<cfelse>
<cfoutput><p>Your original string: <strong>#Form.myText#</strong></p>
<p>Your changed string, showing only the <strong>#Form.removeChars#
</strong> leftmost characters:
<strong>#Left(Form.myText, Form.removeChars)#</strong></p>
</cfoutput>
</cfif>
<cfelse>
<p style="color: red; font-weight: bold">Please enter a string of more than 0 (zero) characters.</p>
</cfif>
</cfif>

<form action="<cfoutput>#CGI.ScriptName#</cfoutput>" method="POST">
<p>Type in some text<br />
<input type="Text" name="myText"></p>
<p>How many characters from the left do you want to show?
<select name="RemoveChars">
<option value="1">1
<option value="3" selected>3
<option value="5">5
<option value="7">7
<option value="9">9</select>
<input type="Submit" name="Submit" value="Remove characters"></p>
</form>

Hope it helps..

Sevor Klu
Translate
June 28, 2006
Primalx2003, I think that will work perfectly, i will give it a try and let you know...thanks!
Translate
Inspiring
June 28, 2006
Find out the syntax for selecting substrings in access (I don't know it myself).
Translate