it doesnt work that way.
you cant put variables in the macro, BUT you can in code.
instead of macro, use vb:
Code:sub btnPrint_click() vFile = "c:\folder\" & Format(date,"dd-mm-yyyy") & forms!myForm!PatientName & ".rtf" docmd.OutputTo acOutputReport ,"rptMyReport",acFormatRTF,vFile end sub
Thank you its worked perfectly .it doesnt work that way.
you cant put variables in the macro, BUT you can in code.
instead of macro, use vb:
Code:sub btnPrint_click() vFile = "c:\folder\" & Format(date,"dd-mm-yyyy") & forms!myForm!PatientName & ".rtf" docmd.OutputTo acOutputReport ,"rptMyReport",acFormatRTF,vFile end sub