opening report from form with variable recordsource

P

phleduc

I am opening a report from a form in designview while changing the
recordsource. (see code below)
This works well, the report opens with the appropriate data source
but when I am closing the report wiht the "close" button (print preview
toolbar), it opens in design view.
This does not happen when I close the report with the "close window" x on
the right side of the menu bar?
Anybody an idea how to make it work from the close button as well?

Me.application.Echo False
Dim stDocName As String
stDocName = "Rpt1010_FinancialOverviewByMonth_Graph"
DoCmd.OpenReport stDocName, acViewDesign
Reports!Rpt1010_FinancialOverviewByMonth_Graph!Graph1.RowSource =
"SELECT * from Qry1010_ExpensesGraph WHERE [periodval] >= " &
Me.cboGraphStart & " and [periodval] <= " & Me.cboGraphEnd
DoCmd.Save ( OR I tried DoCmd.Save acReport,
"Rpt1010_FinancialOverviewByMonth_Graph")
Me.application.Echo True
DoCmd.OpenReport stDocName, acPreview
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top