Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012

    Unanswered: adding a filed wich will count the lenght of each record in a given field

    Hi guys...
    I need your help again
    I' ve question for you is quite easy:
    i'd like to create a filed in a table which will store the lenght of each values' filed:
    here is my code
    Sub Lung()
    Dim rst As DAO.Recordset
    Dim MyString As String ' Initialize variable.
    Dim MyLen As String
    Dim l As Long
    Set rst = CurrentDb.OpenRecordset("Accounting", dbOpenDynaset)
        With rst
            Do Until .EOF
           !lun = Len([SCHEMA])
    End With
        Set rst = Nothing
    End Sub
    the problem here is that I don't know how to manage the identity
    !lun = Len([SCHEMA])
    in order to make this process wok properly.
    Last edited by jsirico; 02-02-12 at 04:29.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    why do this as a recordset operation
    rather than iterating through a record set it would be far quicker to do this as an upodate statememt

    update mytable set mycolumnlength = len(mycolumn)

    mytable to the name to the table
    mycolumnlength to the name of the column to stroe the length of the string
    mycolumn to the name of the column you want to store the length

    this will only work with string columns not boolean, numeric or datetime columns. in any event datetime columns are stored as numeric.

    as to your second problem I haven't got a clue what you are trying to achieve. you really shoudl have two different threads one for each problem.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2012
    ok. thank you.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts