merge from access to word field inputs three times

C

Chris

I am using automation to get data from access to the subject property of a
word document and then insert this into the document using the following
code.

Sub CreateWordDocument()

On Error GoTo Err_CreateWordDocument:

Set m_appWd = GetObject(, "Word.application") 'open word if currently open

If m_appWd Is Nothing Then 'if word is not open create a new instance of
word
Set m_appWd = CreateObject("Word.application")
End If


Set m_docReport = m_appWd.Documents.Add(Template:="C:\bcquote.dot",
NewTemplate:=False)
With m_docReport
.BuiltInDocumentProperties("Subject").Value = Form_Quotes.ProjectName
.Fields.Update
End With

Err_exit:
Exit Sub

On the template there is a field { Subject \* mergeformat} which seems to
merge ok just the data shows up three times any ideas why?

Thanks
Chris
 
C

Cindy Meister -WordMVP-

Hi Chris,
On the template there is a field { Subject \* mergeformat} which seems to
merge ok just the data shows up three times any ideas why?
If you look at the data in File/Properties, does it also show up three
times, there?

If not, my suspicion is that the DocProperty field has been inserted three
times. Press Alt+F9 an take a look...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top