Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing Table by looping through fields with different number

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
I am going through a description field in a table separated by spaces

I am using Split to capture each word in a separate field and the place it in the same table in field1, field2, field3 each time I loop around

How can I code the [BOLD] rst!field1 = splt [/BOLD] since the number 1 is placed in through a counter?

it does not recognize [BOLD] rst!Field & Cnt = splt [/BOLD]

Code:
    Do While rst.EOF = False
    Cnt = 1
    
        Wrd = Split(Nz(rst!Description, ""), " ")
        
            For Each splt In Wrd
                rst.Edit
                rst!Field & Cnt = splt
                Cnt = Cnt + 1
'                On Error Resume Next
                rst.Update
            Next
            
        rst.MoveNext
    
    Loop
 
I searched while waiting

and did this and it works!

Code:
rst.Fields("Field" & Cnt) = splt
 
What PHV’s hint is, I think, it is a VERY BAD IDEA to have a table with a structure like:
[tt]
Field1
Field2
Field3
Field4
...
[/tt]
And it is nightmare to program against.


Have fun.

---- Andy
 
This was all for a temp table and not a structural permanent table!

I also did not have a chance to read the article!

Thanks guys!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top