Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
merge word with access
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? -- Thankfully, YisMan |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
merge word with access
See the "Super Easy Word Merge" item at
http://www.members.shaw.ca/AlbertKal.../msaccess.html -- 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 "YisMan" wrote in message ... 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? -- Thankfully, YisMan |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word should catalog misspelled words to study. | Microsoft Word Help | |||
Word & WordPerfect | Microsoft Word Help | |||
Converting Word Perfect forms to Word forms | Microsoft Word Help | |||
WP merge file to Word | Tables | |||
In Word, how can I see all files (*.*) in "save as"? | New Users |