A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Creating a table - printing ignores next field



 
 
Thread Tools Display Modes
  #1  
Old December 3rd 07, 12:43 AM posted to microsoft.public.word.tables
Roy Lehmann
external usenet poster
 
Posts: 6
Default Creating a table - printing ignores next field

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.

Ads
  #2  
Old December 3rd 07, 02:51 AM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,832
Default Creating a table - printing ignores next field

Have you actually executed the merge?

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

"Roy Lehmann" wrote in message
news
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.



  #3  
Old December 3rd 07, 05:40 AM posted to microsoft.public.word.tables
Roy Lehmann
external usenet poster
 
Posts: 6
Default Creating a table - printing ignores next field

This is not mail merge. I am inserting a table and populating each cell.

"Doug Robbins - Word MVP" wrote:

Have you actually executed the merge?

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

"Roy Lehmann" wrote in message
news
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.




  #4  
Old December 3rd 07, 09:43 AM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,832
Default Creating a table - printing ignores next field

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


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

"Roy Lehmann" wrote in message
...
This is not mail merge. I am inserting a table and populating each cell.

"Doug Robbins - Word MVP" wrote:

Have you actually executed the merge?

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

"Roy Lehmann" wrote in message
news
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.






  #5  
Old December 3rd 07, 06:43 PM posted to microsoft.public.word.tables
Roy Lehmann
external usenet poster
 
Posts: 6
Default Creating a table - printing ignores next field

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.

"Doug Robbins - Word MVP" wrote:

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


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

"Roy Lehmann" wrote in message
...
This is not mail merge. I am inserting a table and populating each cell.

"Doug Robbins - Word MVP" wrote:

Have you actually executed the merge?

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

"Roy Lehmann" wrote in message
news 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.







 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail merge erroneously ignores populated fields in my MS-SQL datab crimsonkng Microsoft Word Help 2 May 19th 06 02:29 PM
MailMerge Through VBA Printing Actual Field Names NOT Field Values AndrewC Mailmerge 1 April 23rd 06 08:07 AM
word 2003 error, cuts off ignores pages after 1st page zarchian Microsoft Word Help 1 March 3rd 06 12:34 PM
Creating a table inside an existing table Eric Schmieder Tables 2 October 13th 05 05:45 PM
Word 2003 ignores top & bottom margin setting in page setup JQLouie Page Layout 1 October 4th 05 01:31 PM


All times are GMT +1. The time now is 06:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004-2020 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.