RE: Passing Qry as part of Rpt DoCmd.OpenReport



On my snippyness, you mis-interpeted my notification, it was meant to advise
you nothing more.

Where: I havent included the keyword "where" in my DoCmd.Open report, should
I?

Perhaps I'm missing something, my understanding was that a filter is applied
after the data is returned and that the "where" clause was part of the
initial dataset creatation?

"Klatuu" wrote:

The argument you are using in the OpenReport method is the Filter argument.
You are, by your description, trying to filter the output of the report.
Maybe that is where I derived the word.

Sorry you did not understand the post. Maybe you need more explanation.
If you create a string that is a Where Clause without the word Where, you
use it in the Where argument of the OpenReport method. By definition, the
Where Clause Filters records (there is that word again).

If you need further explanation, please post back.

BTW, I don't mind you rating as unhelpful, but I do take exception to your
attitude. This site is not manned by paid Microsoft employees. We are all
volunteers. Most of us are Access developers working either on our own or
for a company doing Access development work. So, If you don't get the answer
you want, post back with a question for clarification. Being snippy to other
posters won't get you many answers for very long.

I suggest you visit this site:
http://www.mvps.org/access/netiquette.htm
--
Dave Hargis, Microsoft Access MVP


"JeffP->" wrote:

I'm not sure where you derived the word "filter" from? I've marked your reply
"No" unhelpful, if you'd like me to correct it consider the following,
perhaps I am wrong.

Note that in my DoCmd there are two commas after view type, the first closes
viewtype and the second the empty filter value followed by the where clause.
DoCmd.OpenReport sReportName, acViewPreview, , sQry

And yes my data query is plain vanillia with no where clause only a single
join to get the year from the year/invoice order range table, and again my
year query works fine and if I paste in the value from sQry into my data
query add the keyword where it runs perfect returning my known data.

TIA

JeffP...

"Klatuu" wrote:

May I offer a better solution. Make your query for the record source of
your report plain vanilla with no filtering other than what would be needed
to include all records for the report. Then, rather than using the Filter
argument of the OpenReport, use the Where argument of the OpenReport. It is
like putting a Where clause in your query. Using the Where argument makes it
a lot more flexible.

--
Dave Hargis, Microsoft Access MVP


"JeffP->" wrote:

If the selected manufacturer = "_All" first value in list, then my query
sQry = "Year = " & ddlYear.Value
else: sQry = "Year = & ddlYear.Value & " and manufacturer = " & ddlManu.Value
... also tried: "...=" & "'" & ddlManu.Value & "'"
DoCmd.OpenReport sReportName, acViewPreview, , sQry

Checking the value of sQry shows "Year = 2007 and manufactuer = 'TRMCO'" But
I still get the same data set as "Year = 2007" When I query by pasting the
same where clase into my data query I get only TRMCO w/in 2007.

Any help or insight ?

.



Relevant Pages

  • Re: Use wildcard in combo box with multiple strings
    ... Add the field to the query then. ... filter by it, it has to be in the query... ... use the field to filter what rows are in the RecordSource for the report. ... The string you use as a filter must repeat the name of the field for ...
    (microsoft.public.access.forms)
  • Re: Need help applying SQL statement to Access2000 Query
    ... >WHERE clause, but with an ORDER BY clause. ... >construct the filter string and then open the main form (or report). ... to build the query and open the Main Form or a report ...
    (microsoft.public.access.formscoding)
  • Re: filtering reports
    ... Does this relate to the idea of the Filter or assigning the ... >I put in the code for the query supplied report ... >>If you need to combine two conditions, mock up a query ... > SQL View (View ...
    (microsoft.public.access.formscoding)
  • Re: Count Unique Values with sorting and filtering by pop-up form
    ... here is a sample of code I use to apply filter ... query criteria will be valid only when the report is loaded. ... > MS Access MVP ...
    (microsoft.public.access.reports)
  • Re: Report from a filtered form?
    ... is actually a lookup table (not lookup field). ... > problem filter active. ... > query of the report. ...
    (microsoft.public.access.forms)