Function to shorten column

Posted on 2006-04-04
Last Modified: 2010-04-07
I need a function that will make a column in my table from 29 words to 25 words another words shorten it from 29 words to 25 words.
Question by:thenone
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    you have to specify what you understand by "words".
    For the others, the database is MySQL 5 (as from previous post)...

    LVL 8

    Author Comment

    my mistake all of the words are seperated with a space.
    LVL 142

    Accepted Solution

    the following code should work "more or less", not tested

    dim rs as adodb.recordset
    dim f () as string

    set rs = new adodb.recordset 'select * from yourtable'

    while not rs.eof
      f = split( rs.field("words_column").value, " ")
      redim preserve f ( 0 to 24 ) as string
      rs.field("words_column").value = rtrim( join ( f, " "))

    LVL 8

    Author Comment

    Yeah that should work a little sloppy but I only need it to run one time thanks angel

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now