I need to make some changes to a Query/select/print report using word application. What I need to do is change the way Word is called yet keep the process the same. Word is used so changes can be made before actual printing. Need some way of calling Word as a mail merge with the information from an Access table that the current report uses.
I have seen mail merge templates that use something like <<field name>> in them that uses a table. Reason for the change is the need for some graphics in the report and rtf will not carry the graphics across to word.
Here is the current code that is used when a person selected the desired information from a list box and a command button is clicked and the following is performed.
Can the DoCmd.OutputTo be changed to use a mail merge document? I can create a word template that looks like the Access "Trans_memo_141 _Word" report if that is needed.
Thanks in advance
I have seen mail merge templates that use something like <<field name>> in them that uses a table. Reason for the change is the need for some graphics in the report and rtf will not carry the graphics across to word.
Here is the current code that is used when a person selected the desired information from a list box and a command button is clicked and the following is performed.
Code:
Dim valSelect As Variant Dim strWhere As String Dim strSQLSelect As String Dim AnyItemsSelected As Boolean AnyItemsSelected = False Dim qd As DAO.querydef strWhere = "[rec_no] In (" For Each valSelect In Me.SelectPrintItems.ItemsSelected strWhere = strWhere & Me.SelectPrintItems.ItemData(valSelect) & ", " AnyItemsSelected = True Next valSelect strWhere = Left(strWhere, Len(strWhere) - 2) 'removes last comma and space strWhere = strWhere & ")" If AnyItemsSelected = False Then MsgBox ("You must make a selection(s) from the list before sending to Word !") GoTo Exit_Send2WordButton_Click Else strSQLSelect = "SELECT rec_no, med_rec_no, first_name, last_name, trans_memo " & _ "FROM Translated_memo WHERE " & strWhere Set qd = CurrentDb.QueryDefs("send2WordQuery") qd.SQL = strSQLSelect 'fill SQL MsgBox ("Only one MS Word document may be open at a time. After you Edit and Print " & _ "you may want to Save the document before exiting Word!") DoCmd.OutputTo acOutputReport, "Trans_memo_141_Word", acFormatRTF, "Selected_141_report.rtf", True End If
Thanks in advance
Comment