problem with printing reports based on date query

history

Egyptian Pharaoh
Local time
Today, 11:05
Joined
Jan 26, 2008
Messages
190
Hello Friends

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.
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.

How I can do this by VB code
I hope that I succeeded in explaining my case to get your help

Thank you in advance

Waiting your needed help




 
Hello Friends

Is there any body can give a look to my problem ????
 
This messagebox code may help

If Msgbox("Do you want to print ????",vbQuestion + vbYesNo,"More text") = vbYes then
' do something
else
'do something or nothing"
end if
 
Thanks a lot for your help
I forgot to tell that I need multiple copies ... I'm sorry and I peg your pardon
The problem that when I hit the command button it prints just one copy for the first condition 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
 

Users who are viewing this thread

Back
Top Bottom