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 / June 2006

Tip: Looking for answers? Try searching our database.

merge word with access

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
YisMan - 25 Jun 2006 16:08 GMT
hi everyone, this is my code which is the event handler for a button on a ms
access 2003 form:

Private Sub btMerge_Click()
Application.FollowHyperlink DLookup("receiptaddress", "settings")
Dim apWord As Word.Application
Set apWord = GetObject(, "word.application")
Dim docMerge As MailMerge
Set docMerge = apWord.ActiveDocument.MailMerge
With docMerge
   If .MainDocumentType = wdNotAMergeDocument Then
       .MainDocumentType = wdFormLetters
       .OpenDataSource CurrentProject.FullName, , , , , , , , , , , "query
qrreceipts"
   End If
   .DataSource.QueryString = "select * from qrreceipts where [ReceiptID]="
& [ReceiptID]
End With
End Sub

the code runs fine and the document opens ok, then i get the security
message about the sql statement,so far so good.
then something funny happens, word opens the automating access database
*ANEW*! why, o why? its open there on the screen, it just makes everything so
foncusing.
moreover, more often then not an error is generated stating something about
a "Admin" useraccount not allowing it to open the db exclusively. but it is
OPEN!
can anyone help me simplify this mess?
Signature

Thankfully, YisMan

Doug Robbins - Word MVP - 25 Jun 2006 16:24 GMT
See the "Super Easy Word Merge" item at
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> hi everyone, this is my code which is the event handler for a button on a
> ms
[quoted text clipped - 29 lines]
> OPEN!
> can anyone help me simplify this mess?
 
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.