Access AND Word Template Question..HELP

B

Bules

I have an access database that I have a client put the
information into the database. I have a command button to
generate an employee letter which opens my word template
which is set up to merge. The only problem I am having is
to take the ticket_no.value from access and send to Tools,
Mail Merge, Query Options, Compare to box so I can have it
automatically merge. Below is the access code and below
that is the word code. Right now I'm popping up the
dialog box so she can type it in. I am already passing
through this number in a bookmark, but cannot get it
populated in the query Options compare tab.
Thanks in advance.

Sub MakeLetter()

Dim x As Object
Dim doc As Word.Document
Dim y As String

Set x = CreateObject("Word.application")
x.Visible = True
y = Form_frmMain.TICKET_NO.Value

Set doc = x.Documents.Add("c:\Welcomeoriginal.dot")
doc.Bookmarks("Number").Range.Text = y

End Sub


Sub MergeDoc()

Selection.GoTo What:=wdGoToBookmark, Name:="Number"
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Wrap = wdFindContinue
End With
Selection.EndKey wdLine, wdExtend
Selection.Copy

Dialogs(wdDialogMailMergeQueryOptions).Show

End Sub
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Check out the information on fellow MVP Albert Kalall's site at:

http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top