Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Adding all values in a recodset into a string

Author  Topic 

browndog
Starting Member

4 Posts

Posted - 2003-09-22 : 14:12:36
Hi All,
I am trying to loop through a recorset and capture a value from a field, assign that to a string, then move to next record and as long as it is not EOF I would like to concatonnate all field values into one large string. Problem is everytime I move next I lose the value of the first record.(Obviously)I have done this before I just can't remember how. Here is the code that doesn't seem to work proerly. If anyone can help with this that would be great! Thanks!

If Form_VarPlayers.Recordset.EOF = False Then
Form_VarPlayers.Recordset.MoveFirst
Do Until Form_VarPlayers.Recordset.EOF
varMembers = Form_VarPlayers.Recordset.Fields("ORGANIZATION")
varMembers = varMembers & varMembers
Form_VarPlayers.Recordset.moveNext
Loop
End If

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-09-22 : 14:19:40
[code]
if Form_VarPlayers.Recordset.EOF = False Then
varMembers = ""
Form_VarPlayers.Recordset.MoveFirst
Do Until Form_VarPlayers.Recordset.EOF
varMembers = varMembers & Form_VarPlayers.Recordset.Fields("ORGANIZATION")
Form_VarPlayers.Recordset.moveNext
Loop
End If
[/code]

- Jeff
Go to Top of Page

browndog
Starting Member

4 Posts

Posted - 2003-09-22 : 14:27:54
OK now I get it! Thanks so much Jeff!
Go to Top of Page
   

- Advertisement -