Jumat, 23 September 2011

[MS_AccessPros] Re: report not reading filter

 

David

I don't know what to tell you. Faulty parameters might be failing silently. Without seeing the database, I can't pin down why it is now working for you.

Before I read your entire message, I was about to blame it on Access 2010 SP1. That service pack has a few bugs. One being filter failures. Another being reports opened through VBA don't open. But it sounds like neither of those was your issue.

Bill

--- In MS_Access_Professionals@yahoogroups.com, "David Tolson" <drtolson@...> wrote:
>
> Thank you Bill, I cannot explain this, but I put your code in and the filter
> still would not work; however, I made a slight alteration to the query and
> it worked. But I would think that even if the query was not producing the
> results that I expected, the filer would still filter, even if it is
> filtering based on a faulty set of parameters. Anyway, I'm glad you came to
> my rescue.
>
>
>
> Thanks again and have a great day and an even finer one tomorrow.
>
>
>
> r/David
>
>
>
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Bill Mosca
> Sent: Wednesday, September 21, 2011 11:58 AM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Re: report not reading filter
>
>
>
>
>
> 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
> <mailto:MS_Access_Professionals%40yahoogroups.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
> >
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar