Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
YisMan
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word should catalog misspelled words to study. rndthought Microsoft Word Help 39 May 21st 23 02:47 AM
Word & WordPerfect MrsMac Microsoft Word Help 5 June 10th 06 03:14 AM
Converting Word Perfect forms to Word forms elyse Microsoft Word Help 1 February 15th 06 08:17 PM
WP merge file to Word sstires Tables 4 February 14th 06 06:26 PM
In Word, how can I see all files (*.*) in "save as"? citizen53 New Users 8 April 4th 05 04:56 PM


All times are GMT +1. The time now is 05:31 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"