Good morning all,
I am attempting to modify the output (filename) by changing the .caption of a report. I have found something interesting, if I do not touch the 'caption' of the report, I can print other reports using the same 'template-report' no problemo. When I use the Report_MyReport.caption = "this is it", the report remains open but can not be closed unless I open manually the report then close it... I have attempted the docmd close report with no success.. here is what I have written:
'Here I am changing the value of the caption of the report
Report_NSCRequestFormRPT.Caption = SN.Value
'I am opening the report to debug this problem (not necessary)
DoCmd.OpenReport stDocName, acViewPreview
'Here I am preparing an email to send that report with a changed filename (using caption field it does just that)
DoCmd.SendObject acSendReport, stDocName, acFormatSNP, nscemail.Value, , , "Subject Line", "Email Text"
'Here it should close it.. but no joy (IF I do not modify the caption, it will close it)
DoCmd.Close acReport, "NSCRequestFormRPT"
Suggestion?
Merci!
I am attempting to modify the output (filename) by changing the .caption of a report. I have found something interesting, if I do not touch the 'caption' of the report, I can print other reports using the same 'template-report' no problemo. When I use the Report_MyReport.caption = "this is it", the report remains open but can not be closed unless I open manually the report then close it... I have attempted the docmd close report with no success.. here is what I have written:
'Here I am changing the value of the caption of the report
Report_NSCRequestFormRPT.Caption = SN.Value
'I am opening the report to debug this problem (not necessary)
DoCmd.OpenReport stDocName, acViewPreview
'Here I am preparing an email to send that report with a changed filename (using caption field it does just that)
DoCmd.SendObject acSendReport, stDocName, acFormatSNP, nscemail.Value, , , "Subject Line", "Email Text"
'Here it should close it.. but no joy (IF I do not modify the caption, it will close it)
DoCmd.Close acReport, "NSCRequestFormRPT"
Suggestion?
Merci!