AccessWillKill
Registered User.
- Local time
- Today, 06:32
- Joined
- Oct 2, 2010
- Messages
- 50
Hello,
I'm trying to concatenate together all the ID fields from a table. However for some reason, my recordests are only picking up a single record meaning the loop cannot concatenate.
i might be missing something simple for all i know
my code :
I'm trying to concatenate together all the ID fields from a table. However for some reason, my recordests are only picking up a single record meaning the loop cannot concatenate.
i might be missing something simple for all i know
my code :
Code:
Dim dbs As Database
Dim rst As DAO.Recordset
Dim Counter As Integer
Dim getID As String
Dim ConcatID As String
' set up a updateable recordset of your table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("TmpTblQA", dbOpenDynaset)
' find number of records in your recordset
Counter = rst.RecordCount
' loop until run out of records
While Counter & gt
With rst
ConcatID = ![ContactID].Value
getID = ConcatID & ", " & getID
Debug.Print getID
Debug.Print ConcatID
End With
' moves to next record
rst.MoveNext
' one less record to go
Counter = Counter - 1
' start loop again
Wend
End Function
Last edited: