Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / November 2003

Tip: Looking for answers? Try searching our database.

Mail Merge from Access 2002 worked, but not any more

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Winston Abernathy - 22 Nov 2003 04:09 GMT
Some quick background:  Office 2002.  WinXP.  MS Access
Frontend composed of Forms, reports, queries and a few
tables.  Lots of VBA.  Separate back end DB composed of
only tables.  Mail merge to MSWord worked fine up until
recently.  Major change to system is that I created new
backend db and exported all tables to the new backend.  
Mail merge stopped working.  (not sure of the cause and
effect relationship, but I took the old back end (which
works with Mail merge) and created a new backend (by
removing all tables, compacting and then re-exported
tables to the new backend db - problem repeats so there
is probably a relationship)... Backend has no vba,
however I made all the vba references the same in the
new backend db.  Also tried exporting to brand new db.  
Same problem.  Access Error message as follows:  
"Error 4065:  The method or property is not available
becuase the current mail merge document needs a data
source."

Just a few more quick comments... because I exported all
the tables to a new db, this isn't a simple question of a
missing table.   Also as there is no vba in the backend
db (and I checked the references anyway) that is not a
problem.  I built the backend db about 18 months ago so
if I added something to the db specifically for mail
merges (like a reference) I just can't recall what it
might be.  Again, the frontend code works fine with the
older backend, but something is different in the new
backend.  
A few final comments.  When I try to re-link the
word .dot, I am unable to see the data source from Access
in the non-working db, but can in the working db
(obviously as it works)

Anyone got any ideas?

thanks again
Winston Abernathy
Peter Jamieson - 23 Nov 2003 15:51 GMT
The error message you are getting is saying that the Word document whose
mailmerge object you are trying to .Execute does not have a data source
attached. But are you attaching the data source in code using the
OpenDataSource method (and if so, could you post the code here?) or are you
setting it up manually in Word (i.e. so no OpenDataSource should be needed)?

Also, which connection method are you using to connect to your data?
--
Peter Jamieson - Word MVP

> Some quick background:  Office 2002.  WinXP.  MS Access
> Frontend composed of Forms, reports, queries and a few
[quoted text clipped - 34 lines]
> thanks again
> Winston Abernathy
- 23 Nov 2003 21:03 GMT
I am using the Jet connection.  I eventually got it to
work by copying the db, deleting all but the mail merge
table and then exporting all other tables to the new db.  
Not sure why it works, but when I started from a fresh db
it just wouldn't work.  Perhaps the Word to Access
interface uses some sort of table numbering control
rather than table name.  This may be an oversimplified
perception.  Here is the code (by the way, it had the
same problem when I did it manually in Word):

With gobjWord
  ' Make Word visible
  .Visible = True
  ' Open the word document
  .Documents.Open "Z:\TheBackEndDB\MailMergeDocuments\"
& strMailMergeLetterName
  ' Give the document time to open
   DoEvents
  ' Use the MailMerge method to perform a mail merge
   With gobjWord.ActiveDocument.MailMerge
      .Destination = wdSendToNewDocument
      .SuppressBlankLines = True
      .Execute
   End With
  ' Send the result to the print preview window
      .ActiveDocument.PrintPreview   'Preview
      ' Make Word visible
      .Visible = True
  End With
Really appreciate your insight.

Winston

>-----Original Message-----
>The error message you are getting is saying that the Word document whose
[quoted text clipped - 47 lines]
>
>.
Peter Jamieson - 24 Nov 2003 10:03 GMT
First, from your description I'd suspect that you secured the tables in some
way when you first did this and that the security information is being
carried across if you copy but not if you create tables from scratch.

As for specific points...

> I am using the Jet connection.

OK, not sure what you mean by this - did it involve creating a .odc file? I
was thinking of "DDE", "ODBC", "OLEDB" connection types.

> Perhaps the Word to Access
> interface uses some sort of table numbering control
> rather than table name.

Nothing I've ever seen would lead me to this hypothesis - as far as I know
it just uses a combination of the following:
a. the database (.mdb) file name
b. a connection string, whose contents vary depending on the type of
connection
c. an SQL query

(b) and (c) may be embedded in Word or specified inside a .odc.

You may be able to see what Word is using for (b) and (c) are by printing
the values of

gobjWord.ActiveDocument.MailMerge.DataSource.ConnectString

and

gobjWord.ActiveDocument.MailMerge.DataSource.QueryString

The code you provide doesn't have an OpenDataSource call in it so the
database connection must have been specified beforehand in Word. FWIW as a
matter of sound programming practice I would probably use something more
like

Set objDoc = .Documents.Open("Z:\TheBackEndDB\MailMergeDocuments\" &
strMailMergeLetterName)

then

With objDoc.MailMerge

etc.

--
Peter Jamieson - Word MVP
> I am using the Jet connection.  I eventually got it to
> work by copying the db, deleting all but the mail merge
[quoted text clipped - 92 lines]
> >
> >.
Winston Abernathy - 24 Nov 2003 21:20 GMT
Thanks... I will have to do a bit of work to check out
your suggestions.  They sound quite probable.
Thanks again.
Winston Abernathy

>-----Original Message-----
>First, from your description I'd suspect that you secured the tables in some
[quoted text clipped - 13 lines]
>
>Nothing I've ever seen would lead me to this hypothesis -
as far as I know
>it just uses a combination of the following:
> a. the database (.mdb) file name
[quoted text clipped - 127 lines]
>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.