Re: How to use access query computed fields in Word mailmerge

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Once you have gone through the connection process once, Word should remember
the connection and your users should not have to make it (unless you are
distributing the application for use on systems where the files will be in
different folders etc., and it doesn't sound as if you are). The users may
encounter one or more security-related messages (at least one from Word
about SQL, and one from Access) but they should not have to pick a table or
query name.

To make a DDE connection in code from Word 2000/2002 I think you will need
to do at least the following:

ActiveDocument.MailMerge.OpenDataSource _
Name:="the full pathname of your access .mdb", _
Connection:="QUERY the query name", _ ' or "TABLE the table name"
SQLStatement:="SELECT * FROM [the table or query name]"

Peter Jamieson
"Rey" <Rey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:702E4CB9-1B39-4878-BF12-8B36FAE9B0B6@xxxxxxxxxxxxxxxx
> Peter:
> Thank you. Your reply adds some light to the problem I am
> encountering. I have a followup question: Is there a way that I can
> specify
> either in the Macro Call to do the open source
> (ActiveDocument.MailMerge.OpenDataSource) or in some other parameter to
> use
> the DDE without prompting me? The people in the church that I am writing
> the
> code for know nothing about programming and I really do not want them to
> be
> prompted for something they do not really understand and hence are likely
> to
> answer the wrong thing.
> Thanks,
> Rey
> "Peter Jamieson" wrote:
>
>> You have to check Word Tools|Options|General|Confirm conversion at open
>> then
>> connect tot he Access database again and select the DDE option when it is
>> offered. Word 2002/3 changed the default method Word connects to Access
>> from
>> DDE to OLEDB. OLEDB just uses the underlying Jet database engine to get
>> the
>> data, and it doesn't actually know how to execute user-defined functions
>> created in Access. DDE starts Access, which does not how.
>>
>> Peter Jamieson
>>
>>
>> "Rey" <Rey@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:D650A0AE-4B08-4AE7-ABB5-2007678D0E0D@xxxxxxxxxxxxxxxx
>> >I just upgraded from Word 97 to Word 2003. When I try to use an Access
>> > database in a mailmerge, the queries in Access that use computed fields
>> > using
>> > functions that I created do not show up in the Word queries available
>> > for
>> > mailmerge. My access databases have lots of these computed query
>> > fields.
>> > There is probably an option somewhere that I need to set to be able to
>> > do
>> > this but I can not find a way to do that. To reproduce this "problem"
>> > create
>> > an access database (say TryIt.mdb)with any data in it. Then define a
>> > query
>> > called "TestQ" One of the fields there would be Example:Mydate(). In
>> > the
>> > common code you define a function as "
>> > Function Mydate() as Date
>> > Mydate = Date
>> > end function
>> > Now create a Word document and try to link to TryIt.mdb and the TestQ
>> > query.
>> >
>> > Any assistance on this would be very much appreciated.
>> > --
>> > Rey
>>
>>
>>


.



Relevant Pages

  • Re: error messages when connecting to an MS Access query
    ... I'm actually opening the Word document from VBA in the Access database, ... It's actually easy to run a Make Table query in Access, ... I got messages saying it couldn't make the connection. ... When you try to make a DDE connection, if the database is not already ...
    (microsoft.public.word.mailmerge.fields)
  • Re: How to use access query computed fields in Word mailmerge
    ... the DDE without prompting me? ... "Peter Jamieson" wrote: ... My access databases have lots of these computed query fields. ... >> an access database with any data in it. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Mail Merge Query Word 2007
    ... "Peter Jamieson" wrote: ... I have gone with the DDE connection as users do ... to amend the query. ... Word 2000 used to use DDE by default to connect to Access data (although ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Mail Merge Query Word 2007
    ... There's a Technet article about the "User Account Control" in Vista at ... I have gone with the DDE connection as users do need ... to amend the query. ... Word 2000 used to use DDE by default to connect to Access data (although you ...
    (microsoft.public.word.mailmerge.fields)
  • Re: error messages when connecting to an MS Access query
    ... You're right, Peter, I have a user-defined function in my query. ... I tried using a DDE connection, but I wasn't able to get it to work. ... you should be able to get around this by using the old DDE ...
    (microsoft.public.word.mailmerge.fields)