ajolson1964
Programmer
I have a command button that, updates data in a table then starts the mail
merge wizard. The user then selects the directory and the name of the file
to merge a presto works great.
Here is that code
Dim StrName As String
' This deletes the content of a table and replaces it with new information
DoCmd.SetWarnings False
DoCmd.OpenQuery ("DeleteGasRockWeeklyReport")
DoCmd.OpenQuery ("AllWeeklyReportinfoToDocument")
DoCmd.SetWarnings True
' *********** Code Start ************
' 'This example starts the Word Mail Merge wizard using the query passed to
it.
StrName = "AllWeeklyReport"
DoCmd.SelectObject acTable, StrName, True
DoCmd.RunCommand acCmdWordMailMerge
Exit Sub
End Sub
I want to take this to the next level. What I want to do is when the user
clicks on the command button; it merges with and opens the document without having to use the wizard.
I have looked and looked for some code to do this but what I find just does not work.
So does anyone have code that I Could add to what I already have that will
allow the user to click the command button and the file open up with the
merged data?
Thanks
Andy
merge wizard. The user then selects the directory and the name of the file
to merge a presto works great.
Here is that code
Dim StrName As String
' This deletes the content of a table and replaces it with new information
DoCmd.SetWarnings False
DoCmd.OpenQuery ("DeleteGasRockWeeklyReport")
DoCmd.OpenQuery ("AllWeeklyReportinfoToDocument")
DoCmd.SetWarnings True
' *********** Code Start ************
' 'This example starts the Word Mail Merge wizard using the query passed to
it.
StrName = "AllWeeklyReport"
DoCmd.SelectObject acTable, StrName, True
DoCmd.RunCommand acCmdWordMailMerge
Exit Sub
End Sub
I want to take this to the next level. What I want to do is when the user
clicks on the command button; it merges with and opens the document without having to use the wizard.
I have looked and looked for some code to do this but what I find just does not work.
So does anyone have code that I Could add to what I already have that will
allow the user to click the command button and the file open up with the
merged data?
Thanks
Andy