PC Review


Reply
Thread Tools Rate Thread

Mail Merge Problem

 
 
=?Utf-8?B?QW1vdXI=?=
Guest
Posts: n/a
 
      1st Aug 2007
Hi, I am really new to Access and Word (2003)
I want to mail merge but for some reason it is not filling in the << Name >>
all the fields. What I want is to automaticly open the word document (this
works) and to automaticly populate the fields (this is the problem). This is
in the VB function:

Function mergeinfo(docum, textfile, sqlstr)
On Error GoTo Error_AccessToWord
Dim WordDoc As Object
Dim constr As String

On Error Resume Next
Set appWord = GetObject(, "Word.Application")
If Err.number <> 0 Then
MsgBox "Starting Word . . . "

Err.Clear
Set appWord = CreateObject("Word.Application")
End If
Set WordDoc = appWord.Documents.Open(textfile)

'Enable viewing the Word session and its document
appWord.Visible = True

With WordDoc.MailMerge
' constr = "DSN=MS Access 97 " _
& "Database;DBQ=s:\asbdata\asb2\asbdata.mdb;" _
& "FIL=MS Access;"

'.OpenDataSource "s:\asbdata\asb2\asbdata.mdb", , , True, True, , ,
, , , , constr, sqlstr

WordDoc.MailMerge.OpenDataSource
Name:="C:\asb6\datafiles\letter03file.mdb", _
LinkToSource:=True, AddToRecentFiles:=False, _
Connection:="TABLE tblTempBTO", _
sqlstatement:="SELECT * FROM [tblTempBTO]"

.Destination = wdSendToNewDocument
'Execute the mail merge

WordDoc.MailMerge.Execute
End With
'WordDoc.Close (wdDoNotSaveChanges)
Exit Function


Error_AccessToWord:
AppActivate "Microsoft Access"
Beep
MsgBox "The Following Automation Error has occurred:" & vbCrLf &
Err.Description, vbCritical, "Automation Error!"
Exit Function


End Function



WHAT AM I DOING WRONG!

Thank You for any help!



 
Reply With Quote
 
 
 
 
pietlinden@hotmail.com
Guest
Posts: n/a
 
      1st Aug 2007
How did you insert the chevrons? If you did it manually, that's the
problem. You have to insert the fields from the database. Once you
specify the recordsource, you should have a dropdown in the top left
of the toolbars where you can select the fields you want in your merge
document. Of course, you could do teh easy thing and get Albert's
"Super Easy Word Merge" from his website...

 
Reply With Quote
 
=?Utf-8?B?QW1vdXI=?=
Guest
Posts: n/a
 
      2nd Aug 2007
Hi, and thank you for your help.

OK now I am really confused. What do you mean recordsource and do you mean
within the main word document or within VB as a statement and if so then how
would I right this statement. Also I don't know the term: "Albert's Super
Easy Word Merge" where can I find it?

I tried though MS-Word to:

TOOLS: Letters and Mailings: Mailmerge: Next: Next: Browse: Select Datafile
that has data to merge: Select Table: Mailmerge Recipients: Next: More Items:
Select field to insert:.

Then I saved the document and ran the program (no change).

Please help and thank you!


"(E-Mail Removed)" wrote:

> How did you insert the chevrons? If you did it manually, that's the
> problem. You have to insert the fields from the database. Once you
> specify the recordsource, you should have a dropdown in the top left
> of the toolbars where you can select the fields you want in your merge
> document. Of course, you could do teh easy thing and get Albert's
> "Super Easy Word Merge" from his website...
>
>

 
Reply With Quote
 
=?Utf-8?B?QW1vdXI=?=
Guest
Posts: n/a
 
      2nd Aug 2007
Hi, again (I guess U come in late) and thank U for helping.

I looked up: "Super Easy Word Merge" and found it to be doing the samething
as my VB Code. It opens the document, but with << >> instead of a name. So
what is going on, do U (in 2003 word) have to manaully run mail merge?

Thank You for help....


"(E-Mail Removed)" wrote:

> How did you insert the chevrons? If you did it manually, that's the
> problem. You have to insert the fields from the database. Once you
> specify the recordsource, you should have a dropdown in the top left
> of the toolbars where you can select the fields you want in your merge
> document. Of course, you could do teh easy thing and get Albert's
> "Super Easy Word Merge" from his website...
>
>

 
Reply With Quote
 
pietlinden@hotmail.com
Guest
Posts: n/a
 
      2nd Aug 2007
On Aug 2, 12:32 pm, Amour <Am...@discussions.microsoft.com> wrote:
> Hi, again (I guess U come in late) and thank U for helping.
>
> I looked up: "Super Easy Word Merge" and found it to be doing the samething
> as my VB Code. It opens the document, but with << >> instead of a name. So
> what is going on, do U (in 2003 word) have to manaully run mail merge?
>
> Thank You for help....
>
> "pietlin...@hotmail.com" wrote:
> > How did you insert the chevrons? If you did it manually, that's the
> > problem. You have to insert the fields from the database. Once you
> > specify the recordsource, you should have a dropdown in the top left
> > of the toolbars where you can select the fields you want in your merge
> > document. Of course, you could do teh easy thing and get Albert's
> > "Super Easy Word Merge" from his website...


you have to read the instructions on Albert's code. If I remember
right, it's documented right on the website.

 
Reply With Quote
 
=?Utf-8?B?QW1vdXI=?=
Guest
Posts: n/a
 
      2nd Aug 2007
Thank You again...

Well I went line by line on this and at the end it says:

Note that when you merge with the template, the result has NO merge fields
in it. It is a nice standalone document that you can print, email, or do
whatever you want with (there is no connection to the access file that
remains).


So what is this saying? It sounds like by the line: "the result has NO
merge fields in it" it will not automaticly populate. I want it to
automaticly populate when the VB code opens the word document.

I don't want to have to do:

TOOLS: Letters and Mailings: Mailmerge: Next: Next: Browse: Select Datafile
that has data to merge: Select Table: Mailmerge Recipients: Next: More Items:
Select field to insert:.


Each time I run this VB code:

So far: "Super Easy Word Merge" does exactly what my VB is doing. I want
more I want it to write the fields witnin the table to word automaticly when
opening (not just << field name >>.

Thank You for any help....


"(E-Mail Removed)" wrote:

> On Aug 2, 12:32 pm, Amour <Am...@discussions.microsoft.com> wrote:
> > Hi, again (I guess U come in late) and thank U for helping.
> >
> > I looked up: "Super Easy Word Merge" and found it to be doing the samething
> > as my VB Code. It opens the document, but with << >> instead of a name. So
> > what is going on, do U (in 2003 word) have to manaully run mail merge?
> >
> > Thank You for help....
> >
> > "pietlin...@hotmail.com" wrote:
> > > How did you insert the chevrons? If you did it manually, that's the
> > > problem. You have to insert the fields from the database. Once you
> > > specify the recordsource, you should have a dropdown in the top left
> > > of the toolbars where you can select the fields you want in your merge
> > > document. Of course, you could do teh easy thing and get Albert's
> > > "Super Easy Word Merge" from his website...

>
> you have to read the instructions on Albert's code. If I remember
> right, it's documented right on the website.
>
>

 
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
Mail Merge Prompt for each mail and HTML problem Tobey Microsoft Outlook Discussion 1 11th Nov 2009 02:44 PM
Access 2003 mail merge fails to recognise a mail merge document. ColinD Microsoft Access 1 18th Mar 2008 03:33 PM
Mail Merge Problem =?Utf-8?B?V2lsbGlhbTUyNzE=?= Microsoft Word Document Management 3 18th Jul 2007 07:14 AM
Mail-Merge: Can we have master detail relationship or multiple entities in word Mail-Merge? gmax2006 Microsoft Word Document Management 1 28th Mar 2007 07:28 PM
Insert Merge Field problem with Word-Mail Merge from Excel documen =?Utf-8?B?QXVndXN0YSBFLg==?= Microsoft Word Document Management 2 20th Jun 2005 11:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:24 PM.