I have a view report button on a form. Currently, when clicked the report opens in Access preview for the current record via the where clause.
What I need is to have the report open in Word RTF format.
I looked in Help and found the DoCmd.OutputTo write up but it does not seem to have enough variables to allow for the WHERE portion of the code. Does anyone know how to code the DoCmdOutputTo with a where clause?
What I need is to have the report open in Word RTF format.
I looked in Help and found the DoCmd.OutputTo write up but it does not seem to have enough variables to allow for the WHERE portion of the code. Does anyone know how to code the DoCmdOutputTo with a where clause?
Code:
'***************Begin Code **************************
Private Sub Vital_Stats_View_Click()
On Error GoTo Err_Vital_Stats_View_Click
Dim stDocName As String
stDocName = "SelectLabelsVitalStats"
' ***************This line works now **************
DoCmd.OpenReport stDocName, acPreview, , "ID = " & Forms!MasterForm!ID
[COLOR=red]
[b]
'******This is the line I would like to use **************
'DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, "ID = " & Forms!MasterForm!ID
[/color]
bold[/b]
Exit_Vital_Stats_View_Click:
Exit Sub
Err_Vital_Stats_View_Click:
MsgBox Err.Description
Resume Exit_Vital_Stats_View_Click
End Sub
'***************End Code **************************