Recently I come over a sales quote report that pops up a message saying it can’t be opened in preview mode. This happens when user tries to print the report while it’s in preview mode. There is no problem when the printing is initiated directly without going thru the preview mode. I would like to know how I can correct this problem i.e. to allow the report to be printed from preview mode. I tried to scan thru the codes in the report and codeunits but couldn’t find the cause of such problem. If anyone knows the solution to this, please advise. Thank you.
I never tried to correct this. But reason is the field “No. printed”; the field is only filled out when not previewing. When you are in previewing-mode and then choose printout, Navision cannot “go back into the code” and modify the field.
Hello, this is in fact not a problem nor a bug but intended behaviour. Insidethe posted sales documents table (110,112,114,116) and also in most other posted documemnts you will find a field called “No. printed”. Inside the report printing such documents you find a code line like : IF NOT CurrReport.PREVIEW THEN If you are not in a preview, but printing directly, the system calls a codeunit which increments the “No. printed” field. The triggers are executed before you get the report on the screen, which means that - if you chose Preview - the counter does not increment. When you then would print from the preview, the system could not increment anymore as the triggers have been processed already. So the conclusion is: As soon as the condition CurrReport.PREVIEW is tested in a report, you will not be able to print from the preview.
In fact I suspected the Curr.PREVIEW evaluation statement as well. But because I couldn’t find something like ERROR() statement inside the block, I am confused. I tried to comment the CurrReport.PREVIEW statements and the printing from preview mode does work. But disabling these statements are not an appropriate action, i guess. Customer just have to accept the nature of the report. Thanks for your information.