OpenReport problem with [filtername]

  • Thread starter Thread starter Danny Palma
  • Start date Start date
D

Danny Palma

I am trying to open a report by changing its
recordsource. I want to use a query that finds my data
by the most newest record. My orginal report shows all
of the possible records, but I want to have a button
where the user can print the most current record of each
item therefore I had to do a query to search for the most
current record for each item and then try to give this
query to the report. Unfortunately, when I click the
button to open the report I still get the original reports
(all of them not the ones from the query).
I used the following:
DoCmd.OpenReport "Report1", acViewPreview, "Query2"

Is there any special setting I need to set in order to
user Query2 for OpenReport.

Thanks.
 
I am trying to open a report by changing its
recordsource. . . . Unfortunately, when I click the
button to open the report I still get the original reports
(all of them not the ones from the query).
I used the following:
DoCmd.OpenReport "Report1", acViewPreview, "Query2"


What is the actual content of "Query2" when it is used? Perhaps you haven't
constructed the SQL string exactly right? The DoCmd.OpenReport statement
appears to be constructed properly.

Because it is more efficient, I sometimes construct a complete SQL statement
and use it to replace the Report's RecordSource in the Open event of the
Report.

Larry Linson
Microsoft Access MVP
 
Back
Top