P
Philip Leduc
this is the simplified code to: win XP, access 2003, 2000 file format
everything works fine, except when you close the report after viewing it
(using the close button on the toolbar) it opens in design view, if you use
the close window on the top right it works fine.
Why this different behaviour and can it be changed without juggling with the
toolbars?
'open report in design view
Dim stDocName As String
stDocName = "rptX"
DoCmd.OpenReport stDocName, acViewDesign
'change record source
strSQL1 = "Select * from tblX where [Y] =1"
Reports!RptX.Report.RecordSource = strSQL1
'save report
DoCmd.Save acReport, stDocName
'preview report
DoCmd.OpenReport stDocName, acViewPreview
everything works fine, except when you close the report after viewing it
(using the close button on the toolbar) it opens in design view, if you use
the close window on the top right it works fine.
Why this different behaviour and can it be changed without juggling with the
toolbars?
'open report in design view
Dim stDocName As String
stDocName = "rptX"
DoCmd.OpenReport stDocName, acViewDesign
'change record source
strSQL1 = "Select * from tblX where [Y] =1"
Reports!RptX.Report.RecordSource = strSQL1
'save report
DoCmd.Save acReport, stDocName
'preview report
DoCmd.OpenReport stDocName, acViewPreview