David
you are missing a comma from what I can see. Instead of using the Filter argument, use the WhereCondition.
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
When it comes to OpenReport and OpenForm I always explicitly name the arguments just so it is easier to read.
DoCmd.OpenReport ReportName:= "MyReport", _
View:=acViewPreview, _
WhereCondition:= stLinkCriteria
Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile/Bill.Mosca
--- In MS_Access_Professionals@yahoogroups.com, "djsdaddy531" <drtolson@...> wrote:
>
> Great Day, I am attempting to open a report that has a filter in the click event of the button that opens it up> This is the code:
>
> Private Sub btnOpen_Report_Click()
>
> Dim stDocName As String
> Dim stFilter As String
> Dim stDateRange As String
>
> 'set conditions
> stDocName = "rptInvoice2"
> stLinkCriteria = "[JobID]=" & Me.txtJobID
> 'Open report
> DoCmd.OpenReport stDocName, acViewPreview, stLinkCriteria
>
> End Sub
>
> However, the report previews without establishing the filter and it loads all of the records. I am only expecting one record to open with the report.
>
> thanks in advance for your assistance.
>
> r/David
>
Rabu, 21 September 2011
[MS_AccessPros] Re: report not reading filter
__._,_.___
MARKETPLACE
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar