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
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