Strange print problem!!!

rede96

Registered User.
Local time
Today, 20:14
Joined
Apr 2, 2004
Messages
134
Ok, I am quite experienced with database, forms, vba etc. but have never come across this issue before.

I have a form a user opens and enters data. When the user has finished entering data the user will press a command button the will print a report. This is hard coded using VBA, so I know the report name is correct and the report opens in print preview mode no issues.

The user then presses 'Print' in the top right of the screen to print the report that has just opened.

However! Instead of the report being printed the underlying form is printed.:confused::confused::confused:

This only happens on the first one or two tries. Then for no understandable reason the report will print as intended following the exact same procedure that caused the problem in the first place.

Has anyone ever come across this problem before?
 
Can you show us the code behind the print preview button please.
It sounds as if focus is being moved off the print preview.
 
Are you using PrintOut command. you shoul use DoCmd.Open acReport with your report name.
 
Can you show us the code behind the print preview button please.
It sounds as if focus is being moved off the print preview.

Are you using PrintOut command. you shoul use DoCmd.Open acReport with your report name.

Yes I use the docmd.openreport

Code:
DoCmd.RunCommand acCmdSaveRecord 
DoCmd.OpenReport "On Receipt Worksheet Rpt", acViewPreview, , "[ReturnID] =" & Me.ReturnID

I am going to change it so it prints normal without opening the report first, see if that resolves it. But I just can't understand why it is only an intermediate problem.

I have followed the print procedure in the form myself. Done it twice in exactly the same way but go two different print outs!
 
Perhaps your form or report are corrupted.
Save your report temporarily with a different name
Then create a new report with the original name & see if that opens correctly in print preview
If it does, then there is an issue with your original report

Return to the original report & try saving the Me.ReturnID as a variable e.g lngID
Then use the variable in the print preview code
Does that now work correctly first time?
If not, there is an issue with your form

At this point, try DECOMPILING to remove any compile code
Try to preview the report again

As a final resort, try recreating your report and/or form from scratch depending on the earlier results
 
Perhaps your form or report are corrupted.
Save your report temporarily with a different name
Then create a new report with the original name & see if that opens correctly in print preview
If it does, then there is an issue with your original report

Return to the original report & try saving the Me.ReturnID as a variable e.g lngID
Then use the variable in the print preview code
Does that now work correctly first time?
If not, there is an issue with your form

At this point, try DECOMPILING to remove any compile code
Try to preview the report again

As a final resort, try recreating your report and/or form from scratch depending on the earlier results

Hi Colin,

Thanks for the tips. I'll try them out this week and feedback. Cheers.
 
What happen if you click on the report, before you presses 'Print' in the top right of the screen?
Do you've more code behind the command button?
 

Users who are viewing this thread

Back
Top Bottom