I do always so: I design report which include necessary data, save it (name it e.g. MyReport). In cmd button's On Click procedure I write code like following:
private sub cmdMyCommandButton_OnClick()
dim rpt as report 'Declare report
dim strReportName as string
dim strMeName as string
strMeName=me.name 'Active form name
strReportName = "MyReport"
docmd.openreport strReportName,acpreview
set rpt=reports(strReportName) 'Set opened report
rpt.recordsource=me.recordsource 'Change report's recordset to this form recordset
'Here is possible to close
'current form if it's needed
docmd.close acform strMeName
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.