Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Tables / December 2007

Tip: Looking for answers? Try searching our database.

Creating a table - printing ignores next field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roy Lehmann - 03 Dec 2007 00:43 GMT
Weird problem:  Print command ignores NEXT field when printing a document
with records from an access database table.  Displaying the document shows it
properly formatted with all the proper fields and records.  Printing the
document prints it with the first record repeated where succeeding records
should be and the display changes to the document as printed.  This problem
is repeatable.
Microsoft Word 2007, Microsoft Access 2007 with latest updates.
Doug Robbins - Word MVP - 03 Dec 2007 02:51 GMT
Have you actually executed the merge?

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Weird problem:  Print command ignores NEXT field when printing a document
> with records from an access database table.  Displaying the document shows
[quoted text clipped - 5 lines]
> is repeatable.
> Microsoft Word 2007, Microsoft Access 2007 with latest updates.
Roy Lehmann - 03 Dec 2007 05:40 GMT
This is not mail merge.  I am inserting a table and populating each cell.

> Have you actually executed the merge?
>
[quoted text clipped - 7 lines]
> > is repeatable.
> > Microsoft Word 2007, Microsoft Access 2007 with latest updates.
Doug Robbins - Word MVP - 03 Dec 2007 09:43 GMT
AFAIK, the Next field works only with Mailmerge.

How are you populating the table?  Here's how you would use VBA to do it.
You will need to set a reference to the DAO object library to use it:

Dim myDataBase As Database

Dim myActiveRecord As Recordset

Dim i As Long

Dim dtable As Table, drow As Row

'Open a database

Set myDataBase = OpenDatabase("c:\Access\Procurement Plan.mdb")

'Access the first record from a particular table

Set myActiveRecord = myDataBase.OpenRecordset("Currencies",
dbOpenForwardOnly)

'Add a table to the document with one row and as many fields as there are in
the database table

Set dtable = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=1,
numcolumns:=myActiveRecord.Fields.Count)

Set drow = dtable.Rows(1)

'Loop through all the records in the table until the end-of-file marker is
reached

Do While Not myActiveRecord.EOF

   'Populate the cells in the Word table with the data from the current
record

   For i = 1 To myActiveRecord.Fields.Count

       drow.Cells(i).Range.Text = myActiveRecord.Fields(i - 1)

   Next i

    'Add a new row to the Word table and access the next record

   Set drow = dtable.Rows.Add

   myActiveRecord.MoveNext

Loop

'The last row will be empty, so delete it

drow.Delete

'Then close the database

myActiveRecord.Close

myDataBase.Close

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> This is not mail merge.  I am inserting a table and populating each cell.
>
[quoted text clipped - 13 lines]
>> > is repeatable.
>> > Microsoft Word 2007, Microsoft Access 2007 with latest updates.
Roy Lehmann - 03 Dec 2007 18:43 GMT
Thank you for your help.  I learned something.  When you populate a table
using Insert; Quick Parts;  you have to finish it with Mailings; Finish &
Merge;.  This was not obvious since the document displays correctly.

> AFAIK, the Next field works only with Mailmerge.
>
[quoted text clipped - 75 lines]
> >> > is repeatable.
> >> > Microsoft Word 2007, Microsoft Access 2007 with latest updates.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.