Saving a field of a record as a string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a module that will create a string that involves several
records. The record fields are located in a query and the string should look
something like "record1text; record2text; record3text;....". I need to know
how to access this query, save the first record's field as a string and then
move to the second, third, and so forth. I can do the loop and concatenation
of strings, I just need to know how to save the records as strings. Thx
 
Dim rst As Recordset
Dim strCombined As String

Set rst = CurrentDb.OpenRecordset("MyQuery")
Do While Not rst.EOF
strCombined = strCombined & rst!FieldToCombined & ";"
rst.MoveNext
Loop
'Take off the last ;
strComined = Left(strCombined, Len(strCombined) -1)

rst.Close
Set rst = Nothing
 
Back
Top