MS Access to MS Word

oldozziesubby

Registered User.
Local time
Tomorrow, 00:45
Joined
Mar 23, 2007
Messages
26
I'm having a real problem here and I can't work out why.
I have an access database in which I can assemble a lot of maintenance tasks. What I do then is to send them to Word to create a document.
Every thing works well until I try to insert a pagebreak.

I'm using a word template that has a table of 3 rows and one column. Once word is activated the table is selected and copied. No problem. I then use two variables to record the the page that the cursor is on.
intCurrPage = objWord.ActiveDocument.ComputeStatistics(wdStatisticPages, False)
intPrevPage = objWord.ActiveDocument.ComputeStatistics(wdStatisticPages, False)

I then recursively fill the table with data, move to a bookmark, go back a charater, paste the table as new, fill it with data etc.etc.

As I'm doing this I'm checking to see whether current page is different to the previous page. When it is, a pagebreak is inserted and everything carries on as normal. Naturally the intPrevPage is made equal to the intCurrPage

However, on every single page, only five tables are pasted/inserted before the pagebreak is inserted leaving almost half a page blank.

My question is, why? What am I missing or what am I doing wrong?

I'm having sleepless nights trying to work it out.
 

Users who are viewing this thread

Back
Top Bottom