PC Review


Reply
Thread Tools Rate Thread

Combine records in a table

 
 
slickdock
Guest
Posts: n/a
 
      10th Aug 2009
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.
 
Reply With Quote
 
 
 
 
David H
Guest
Posts: n/a
 
      10th Aug 2009
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?

"slickdock" wrote:

> 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.

 
Reply With Quote
 
slickdock
Guest
Posts: n/a
 
      10th Aug 2009
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?

"David H" wrote:

> 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?
>
> "slickdock" wrote:
>
> > 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.

 
Reply With Quote
 
Jack Leach
Guest
Posts: n/a
 
      11th Aug 2009
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)



"slickdock" wrote:

> 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?
>
> "David H" wrote:
>
> > 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?
> >
> > "slickdock" wrote:
> >
> > > 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.

 
Reply With Quote
 
David H
Guest
Posts: n/a
 
      11th Aug 2009
Is it a memo that your working?


"slickdock" wrote:

> 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?
>
> "David H" wrote:
>
> > 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?
> >
> > "slickdock" wrote:
> >
> > > 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.

 
Reply With Quote
 
slickdock
Guest
Posts: n/a
 
      11th Aug 2009
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?

"Jack Leach" wrote:

> 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)
>
>
>
> "slickdock" wrote:
>
> > 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?
> >
> > "David H" wrote:
> >
> > > 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?
> > >
> > > "slickdock" wrote:
> > >
> > > > 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combine two records in a table clk Microsoft Access Form Coding 1 10th Sep 2010 05:23 PM
How to combine two tables and dedup records from one table =?Utf-8?B?Y2FicmFkbGV5MTE=?= Microsoft Access Queries 2 25th Apr 2006 04:25 AM
Do I have to have equal number of records in each table to combine them? david.isaacks@mail.va.gov Microsoft Access Queries 14 20th Apr 2006 10:27 PM
Creating a new table to combine records ie. Mr and Mrs. =?Utf-8?B?THlubiBDYXJsdG9u?= Microsoft Access 2 3rd Dec 2004 07:03 AM
Combine Subsequent Table Records David Frazell Microsoft Access VBA Modules 1 24th May 2004 08:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:29 PM.