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?