Vba – Printing a Report from a Form in Access without a print preview or opening report

formsms-accessprintingreportvba

I have a button on a form that I want the user to be able to print a report without opening the report or viewing a print preview. This is my code so far:

DoCmd.OpenReport "DisplayUncompleteProjects", acNormal
DoCmd.RunCommand acCmdPrint

But my problem is that it is print both my form and the report. I just want to print the report. But I also don't want the user to leave the form page. (aka when they are done printing the report all they can see is still the form.)
Thanks.

Best Answer

Leave out the second line, which just prints the current object, and run only:

DoCmd.OpenReport "DisplayUncompleteProjects", acNormal
Related Topic