this code below is right to my knowledge to open up the report and show the
data for the mailing list. however, i would like to expand this further by
taking the details from the report and then publish it into word by the
click of the button.
this the code i am using to open up the report and show the data. can
someone please help me expand it to my desired result.
Private Sub cmdGo_Click()
Dim stDocName As String
Dim qry As DAO.QueryDef
Dim cy As Page
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Call SetGlobal("ReportMailingID", "", Me.ID)
stDocName = "rMailing1"
DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdCompleteWord
End Sub
I think this is all you need:
Private Sub cmdGo_Click()
' Save the new record
DoCmd.RunCommand acCmdSaveRecord
' Output the report to a document and open the document.
DoCmd.OutputTo acOutputReport, "rMailing1", acFormatRTF, "Path and
File name here.rtf", True
End Sub
If you don't enter the Path and File name, you will be prompted with a
file navigation box to select the folder and name.
The True argument opens the document window.
See VBA help on the OutputTo method for the other acFormats you can
use.
I have no idea what you are doing with rest of the stuff in your Code.