history
Egyptian Pharaoh
- Local time
- Today, 08:03
- Joined
- Jan 26, 2008
- Messages
- 190
I have a problem with printing reports based on date query (the date is placed in a subform on the Mainform).
What I need is to print these reports directly by one command button without showing the reports, under some conditions regarding multiple copies
May be I couldn't explain my case but I will tell in few details :
I have 8 reports :
Report 1 , Report 2 , Report 3 , Report 4 , Report 5 , Report 6 , Report 7 , Report 8
All these reports based on date query, when the user hit the command button it should give prompt box for date to specify the desired date.
First Step
Report 5 , Report 6
will be printed according to the user decision, it should be a message appears to the user asking him if he need to print those reports or not.
If Yes, a prompt box for date will appear to enter the desired date and the reports will be printed and move to the second step
If No, the reports won't be printed and move to the second step.
Second Step
Report 7 , Report 8
will be printed according to the user decision, it should be a message appears to the user asking him if he need to print those reports or not.
If Yes, a prompt box for date will appear to enter the desired date and the reports will be printed and move to the third step
If No, the reports won't be printed and move to the third step.
Third Step
Report 1 , Report 2 , Report 3 , Report 4
A prompt box for date will appear to enter the desired date and the reports will be printed and finish.
The problem that when I hit the command button it prints just one copy for the first step and then print the form itself until the last record
This is the code I'm using
On Error GoTo Err_Command12_Click
a = MsgBox("Do you want to print Report1 & Report 2?", vbYesNo, "Notification")
If a = vbYes Then
DoCmd.OpenReport "Report1", acViewNormal
DoCmd.PrintOut , , , , 2
DoCmd.OpenReport "Report2", acViewNormal
DoCmd.PrintOut , , , , 1
Else
MsgBox "Ok , the reports will not be printed ! Well Done", vbInformation, "No Print"
End If
e = MsgBox("Do you want to print Report3 & Report 4?", vbYesNo, "Notification")
If e = vbYes Then
DoCmd.OpenReport "Report3", acViewNormal
DoCmd.PrintOut , , , , 2
DoCmd.OpenReport "Report4", acViewNormal
DoCmd.PrintOut , , , , 1
Else
MsgBox "Ok , the reports will not be printed", vbInformation, "No Print"
MsgBox "Wait until the printer finish then organize your reports", vbInformation, "Done"
End If
DoCmd.OpenReport "Report5", acViewNormal
DoCmd.PrintOut , , , , 2
DoCmd.OpenReport "Report6", acViewNormal
DoCmd.PrintOut , , , , 2
DoCmd.OpenReport "Report7", acViewNormal
DoCmd.PrintOut , , , , 1
DoCmd.OpenReport "Report8", acViewNormal
DoCmd.PrintOut , , , , 1
Exit_Command12_Click:
Exit Sub
Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click
I'm waiting your help
Thank you in advance
What I need is to print these reports directly by one command button without showing the reports, under some conditions regarding multiple copies
May be I couldn't explain my case but I will tell in few details :
I have 8 reports :
Report 1 , Report 2 , Report 3 , Report 4 , Report 5 , Report 6 , Report 7 , Report 8
All these reports based on date query, when the user hit the command button it should give prompt box for date to specify the desired date.
First Step
Report 5 , Report 6
will be printed according to the user decision, it should be a message appears to the user asking him if he need to print those reports or not.
If Yes, a prompt box for date will appear to enter the desired date and the reports will be printed and move to the second step
If No, the reports won't be printed and move to the second step.
Second Step
Report 7 , Report 8
will be printed according to the user decision, it should be a message appears to the user asking him if he need to print those reports or not.
If Yes, a prompt box for date will appear to enter the desired date and the reports will be printed and move to the third step
If No, the reports won't be printed and move to the third step.
Third Step
Report 1 , Report 2 , Report 3 , Report 4
A prompt box for date will appear to enter the desired date and the reports will be printed and finish.
The problem that when I hit the command button it prints just one copy for the first step and then print the form itself until the last record
This is the code I'm using
On Error GoTo Err_Command12_Click
a = MsgBox("Do you want to print Report1 & Report 2?", vbYesNo, "Notification")
If a = vbYes Then
DoCmd.OpenReport "Report1", acViewNormal
DoCmd.PrintOut , , , , 2
DoCmd.OpenReport "Report2", acViewNormal
DoCmd.PrintOut , , , , 1
Else
MsgBox "Ok , the reports will not be printed ! Well Done", vbInformation, "No Print"
End If
e = MsgBox("Do you want to print Report3 & Report 4?", vbYesNo, "Notification")
If e = vbYes Then
DoCmd.OpenReport "Report3", acViewNormal
DoCmd.PrintOut , , , , 2
DoCmd.OpenReport "Report4", acViewNormal
DoCmd.PrintOut , , , , 1
Else
MsgBox "Ok , the reports will not be printed", vbInformation, "No Print"
MsgBox "Wait until the printer finish then organize your reports", vbInformation, "Done"
End If
DoCmd.OpenReport "Report5", acViewNormal
DoCmd.PrintOut , , , , 2
DoCmd.OpenReport "Report6", acViewNormal
DoCmd.PrintOut , , , , 2
DoCmd.OpenReport "Report7", acViewNormal
DoCmd.PrintOut , , , , 1
DoCmd.OpenReport "Report8", acViewNormal
DoCmd.PrintOut , , , , 1
Exit_Command12_Click:
Exit Sub
Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click
I'm waiting your help
Thank you in advance