Access Merge with Word

M

Maxine

Access 2K to Word 2K. Using an Access command button to open a word merge document whose record source is an Access query. How can I prevent the database from opening twice

Thanks in advance

Maxin
 
P

Peter Jamieson

If something in your database is modifying the string displayed in Access's
title bar, it may be worth disabling that and seeing if that makes any
difference.

Otherwise, I do not think you will get much control over this using DDE,
which is Word 2000's default conection method. An alternative is to use
ODBC, which uses the underlying Jet database engine to get the data without
starting the Access program.

That may be possible if
a. you have control over the Word document,
b. ODBC and the Access ODBC driver are installed on the machine(s) where
the application needs to run
c. the query is a suitable query (in this case that probably means "it
can't be a parameter query"

To do that, go through the connection process again. When you get to the
"Open Data Source" dialog box, select the .mdb and check "Select Method"
before clicking "Open". YOu should then see an additional dialog box which
allows you to select an Access via ODBC option. In the following dialog box,
make sure the database you selected before is still selected in the
drop-down list (the list of tables will probably give you a clue too), then
click the Options button and check all the options - this should make the
dialog display queries as well as tables. Select your query and proceed.

Other caveats include:
a. if your database is secured using a workgroup security database, the
above procedure may not be enough: you might have to set up the connection
in a (Word) VBA OpenDataSource call, providing the logon details as part of
the connection string
b. when Word gets data via ODBC, it tends to get the underlying data as
stored in the database. DDE tends to get the data as you see it in Access.
SO you may need to use more merge field formatting switches in Word to
display/print the data in the formats you want, or use functions in your
Access query to get exactly the data you need in text format
c. you may find that ODBC imposes more limits on the amount of data that
Word will "see" in e.g. memo fields and DDE
d. there could be multiuser locking problems. If so, they might also be
soluble using various Access settings and/or a connection string set up via
VBA.

--
Peter Jamieson

Maxine said:
Access 2K to Word 2K. Using an Access command button to open a word merge
document whose record source is an Access query. How can I prevent the
database from opening twice?
 

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