View Single Post
  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge with Access query as source

FWIW I never use Access forms data as a data source so I cannot tell you
much more about Word2007+Access2007 accdb+DDE than I can find out with
some simple experiments.

First, an example of something that does work here is where you have a
simple query in Access like
SELECT [Forms]![Products].[ProductName]

Let's say this query is called XXX.

As long as my database is open and the Products form is open, I can
connect using the user interface
a. from Word 2003 to mydb.mdb
b. from Word 2007 to mydb.mdb
c. from Word 2007 to mydb.accdb
and select the query XXX and everything is OK. It helps if the
..mdb/.accdb is in a trusted location in Access 2007.

However,
1. if I try to connect programmatically to the same query, (c) is a
problem because Word mangles the database pathname if I tell it to open
a .accdb but specify a COnnection paramter such as "QUERY XXX". I can
only get Word 2007 to connect programmtically using DDE if I rename the
database so that it has extension .mdb (e.g. mydbaccdb.mdb).
Unfortunately I cannot tell you what other consequences using the
extension ".mdb" foa ".accdb" might have.
2. Just because I can do it, does not mean that other things (such as
network-related problems) might not get in the way.

I haven't personally had much luck using query syntax such as

SELECT [Forms]![Products].[ProductName]

in a query I issue from Word VBA (in any version), but if you are doing
that successfully in Word 2003, let me know what syntrax you are using
and I can at least try a simple equivalent here.


Peter Jamieson

http://tips.pjmsn.me.uk

On 10/05/2010 14:53, MikeV wrote:
By using DDE for a .mdb database, is this implying that Word 2007 cannot
communicate with an Access 2007 database via DDE?

When I try this with an Access 2007 database, it still does not work. The
query pulls
a value off a form to satisfy a criteria entry. When I run it, it prompts
for the value instead of pulling it off the form. This worked when both the
Word document and the database were 2003, but in 2007, they don't work. Do I
need to leave my Access database 2003?

"Peter Jamieson" wrote:

The only easy way to do it is to change the way that Word connects to
the data source to DDE

in Word 2007, check Office button-Word options-Advanced-Confirm file
format conversion on open (near the bottom), go through the connection
process again, and you should see an additional Confirm Data Source
dialog box. If you see an entry like "MS Access databases via DDE",
select it. If you only see "OLE DB database files" (typically if you are
using a .accdb rather than a .mdb source), check Show all, then locate
and select that DDE option, and continue. In Word 2003, the option has a
similar name under Tools-Options-General.

Peter Jamieson

http://tips.pjmsn.me.uk

On 21/02/2010 15:52, sailor wrote:
I am trying to create a Word mail merge with an Access database query that
has a parameter (asks for a unique date).
When Word asks for "Select Recipients" I go to my database and the dialog
box lists the database along with all of my Queries EXCEPT QUERIES THAT HAVE
A PARAMETER so I cannot select the parameter query that contains the list of
recipients that I want send to .
How do I get the parameter query to be listed so I can select it to be the
target of my Mail Merge?

.