5 Replies Latest reply on Jun 28, 2006 1:17 PM by WOLFcfm

    Pulling only a certain amount of information from access

    WOLFcfm Level 1
      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"
        • 1. Re: Pulling only a certain amount of information from access
          Dan Bracuk Level 5
          Find out the syntax for selecting substrings in access (I don't know it myself).
          • 2. Re: Pulling only a certain amount of information from access
            primalx2003
            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
            • 3. Pulling only a certain amount of information from access
              WOLFcfm Level 1
              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....
              • 4. Pulling only a certain amount of information from access
                WOLFcfm Level 1
                Primalx2003, I think that will work perfectly, i will give it a try and let you know...thanks!
                • 5. Re: Pulling only a certain amount of information from access
                  WOLFcfm Level 1
                  it works out great, thanks a lot for all your help guys...appreciate it!