If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > duplicates n times a whole record

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-01-12, 12:08
jsirico jsirico is offline
Registered User
 
Join Date: Jan 2012
Posts: 54
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
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
        .Edit
      
       !lun = Len([SCHEMA])
    
      
        
        .Update
         .MoveNext
Loop
.Close
End With

    Set rst = Nothing
End Sub
the problem here is that I don't know how to manage the identity
Code:
!lun = Len([SCHEMA])
in order to make this process wok properly.

Last edited by jsirico; 02-02-12 at 04:29.
Reply With Quote
  #2 (permalink)  
Old 02-01-12, 13:19
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
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)

change:-
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 02-02-12, 04:21
jsirico jsirico is offline
Registered User
 
Join Date: Jan 2012
Posts: 54
ok. thank you.....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On