Hi, Hal. I've done this before, and I can tell you that it works. It'll be
simpler to do it from Word, rather than opening Word from Access through
Automation.
Also, setting up a mail merge in Word from Access can be tricky to set up.
While accessing Word from Access through Automation isn't that difficult,
getting the Word merge settings right can be, depending upon what version
you're using. Even if you use Access to control the process, you'd still be
better off linking your Access data to Word within Word and then just
changing the data from Access and running the merge.
So if you're fine with going into Word and just attaching an Access
database, that would be simpler.
As for why it's not working, queries won't show up in the list. So it has to
be a table. When I've done this in the past, and I had to use a query, I
would first write the query output to a temporary table and then use the
temporary table in the merge.
As for why your tables aren't appearing, I can't really say. In the past,
I've always gotten a complete table list when I did this. You might want to
check in an MS Word newsgroup and see what they say. That would definitely
be a Word issue.
As for importing fields, the merge will import all fields from the table.
You can then select your fields in the document using the toolbar. If you
want to only import some fields, there is a custom SQL option in the Merge
dialogs that will allow you to specify the fields, if that's what you want
to do.
Neil
> Hi, Hal. I've done this before, and I can tell you that it works. It'll be
> simpler to do it from Word, rather than opening Word from Access through
> Automation.
That's what I thought!
> Also, setting up a mail merge in Word from Access can be tricky to set up.
> While accessing Word from Access through Automation isn't that difficult,
> getting the Word merge settings right can be, depending upon what version
> you're using. Even if you use Access to control the process, you'd still
> be better off linking your Access data to Word within Word and then just
> changing the data from Access and running the merge.
Wgat I did was to export a merge .txt file of the query results, opened that
in Word and selected the fields from that.
It seems unneccesarily long winded and if one had a great number of records
would create a massive file. So, while in one sense I have got the data into
Word in a test scenario - it's certainly not in the way I would want to use
it in earnest.
> So if you're fine with going into Word and just attaching an Access
> database, that would be simpler.
You'd have thought it - but it doesn't seem that way to me at the moment!
> As for why it's not working, queries won't show up in the list. So it has
> to be a table. When I've done this in the past, and I had to use a query,
> I would first write the query output to a temporary table and then use the
> temporary table in the merge.
As I mentioned I have 2 tables but only 1 shows - queries don't show at all
as you say.
> As for why your tables aren't appearing, I can't really say. In the past,
> I've always gotten a complete table list when I did this. You might want
> to check in an MS Word newsgroup and see what they say. That would
> definitely be a Word issue.
I'll get me coat.
> As for importing fields, the merge will import all fields from the table.
> You can then select your fields in the document using the toolbar. If you
> want to only import some fields, there is a custom SQL option in the Merge
> dialogs that will allow you to specify the fields, if that's what you want
> to do.
I haven't needed to merge stuff in years and would have thought things would
have become much easier. I can't understand why MS make merging such a
difficult feature to use. Ah well, I better pack my bags and camp out in the
Word group for a while.
> Neil
Hal.
Neil - 29 Nov 2007 17:33 GMT
> Wgat I did was to export a merge .txt file of the query results, opened
> that
> in Word and selected the fields from that.
Well, that's not too bad of a process. If you keep your filename the same
each time, you can just keep that linked to your merge doc. I don't know if
you're going to run this from Access or Word, but if you run it from Access,
you can just delete the file when you're done. Either way, as long as you
overwrite the same file each time, it shouldn't take up too much disk space.
If all your data's in one table, then it would be better to use that.
Otherwise, if you're taking it from a query, then you'd have to output to
something anyway, whether a file or a temporary table. So it's pretty much
the same.
But, do you mind if I ask why you're using Word instead of just doing an
Access report? If you can do it entirely in Access and avoid Word altogether
that would, of course, be the best solution.
> As I mentioned I have 2 tables but only 1 shows - queries don't show at
> all as you say.
Make sure the tables are all closed. Could be that if the table's open that
Word doesn't show it in the list. In fact, close your database altogether
and see what tables show.
> I haven't needed to merge stuff in years and would have thought things
> would have become much easier. I can't understand why MS make merging such
> a difficult feature to use. Ah well, I better pack my bags and camp out in
> the Word group for a while.
I think most of the Word merge stuff is intended to be used within Word.
Getting data from an external source is considered by MS, I guess, to be
something extra. That's just a guess anyway. But I agree it should be
better.
Neil