Jumat, 23 September 2011

RE: [MS_AccessPros] Re: report not reading filter

 

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