On Mon, 18 Jun 2007 21:00:47 -0400, MLH wrote:
Private Sub Command0_Click()
Dim MyReport As Report
MyReport.Name = "rptStateOfAffairs"
MyReport.Filter = "ClusterName = 'Auto Company, Inc'"
Me.FilterOn = True
DoCmd.OpenReport MyReport.Name
End Sub
Above code fails - Access doesn't like the 4th line. What change need
I make to open the report with desired filter spec?
You wish to hard code the filter into this code?
Private Sub Command0_Click()
Dim stDocName as String
Dim stWhere as string
stDocName = "rptStateOfaffairs"
stWhere = "[ClusterName] = 'Auto Company, Inc'"
DoCmd.OpenReport stDocName, acViewPreview, , stWhere
End Sub.
Of course you can simplify the above to:
Private Sub Command0_Click()
DoCmd.OpenReport "rptStateOfAffairs", acViewPreview, , "[ClusterName]
= 'Auto Company, Inc'"
End Sub
Look up the OpenReport method in VBA help for the necessary arguments.
Cbange acViewPreview to acViewNormal to print without previewing.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail