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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through string of id's and perform task

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
579
0
16
GB
Hello,

I am using Allen Browne code to concatenate records from
a table. This results in a string of id's.

For example "10,33,150,345" etc...

I would like to perform a task for each id, (I n this case
adding to a log table).

How would I go about looping through each id so I could
perform my vba code on each id?

Many thanks Mark.
 
Something like

Code:
[blue]    Dim sourcestring As String
    Dim taskdata As Variant
    
    sourcestring = "10,33,150,345"
    
    For Each taskdata In Split(sourcestring , ",")
        MsgBox Trim(taskdata) [green]' this is where you'd perform your task[/green]
    Next[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top