Combine records in a table

  • Thread starter Thread starter slickdock
  • Start date Start date
S

slickdock

I have a temp table with ONE field: RecipientName.
I would like to get that information over to MSWord as one chunk of
information, so WOrd sees it as one record, with each Recipient Name
separated by a hard return, instead of a record break.
 
You'll probably have to loop through each record, grab the value and add it
to a string.

What exactly are you trying to accomplish?
 
I'm trying to insert a list into a Word merge file that otherwise has a
different data source. This "list" will be called by an {IncludeText} field
command in my Word form file.
Your idea sounds good. How can I loop, grab, and add to string?
 
Function GetDataToString() As String

Dim Ret As String
Dim rs as DAO.Recordset

Set rs = CurrentDb.OpenRecordset("tablename")
Ret = ""

If rs.Recordcount <> 0 Then
rs.MoveFirst
While Not rs.EOF
Ret = Ret & rs(0)
rs.MoveNext
Wend
End If

rs.Close
Set rs = Nothing

GetDataToString = Ret
End Function




hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
Is it a memo that your working?


slickdock said:
I'm trying to insert a list into a Word merge file that otherwise has a
different data source. This "list" will be called by an {IncludeText} field
command in my Word form file.
Your idea sounds good. How can I loop, grab, and add to string?
 
OK, since I'm a total VB doofus, I copied and pasted your code into a module.
I made a macro that says RunCode GetDataToString().
Don't laugh, but now what? How do I see the results? Can I store the results
in a field in a query, for example, since that query is going to be the
data.txt file for my MSWord merge doc?
 
Back
Top