G
Guest
MS Access 2K, Windows XP
====================
Hello,
I have a form with a "Submit" button, that performs the following actions:
1. Emails a report based on the current record.
2. Asks the user if s/he wants to print a copy of the report.
3. Asks the user if s/he would like to submit a new request.
I'm using the following line of code to print the report:
=========================================
DoCmd.OpenReport "Request Report", acViewPreview
=========================================
With this line, I get the option to choose the printer, adjust margins etc.,
but the code doesn't wait for me to print the report, and displays the
report, and goes on to ask me if I want to submit a new request.
I've also tried:
===============================================
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
===============================================
This code simply prints the report, without giving me the option to change
Printer settings.
What I'd like to happen is:
1. I get the option to choose/change printer, adjust margins etc. and then
print the report.
2. The messagebox that asks me to submit another request waits till I finish
printing.
I've done a lot of googling, and also checked the Help section, but have
been unable to find a solution. Will appreciate it if someone can point me in
the correct direction, or correct my code. Also, I'd rather not use the
DoMenuItem code.
Here's the code for actions 2. and 3.
==========================================================
If (MsgBox("Would you like to print a copy of this request?", vbYesNo) =
vbYes) Then
'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.PrintOut acSelection
DoCmd.OpenReport "Request Report", acViewPreview
End If
Dim Msg, Style As String
Msg = "Submit another request?"
Style = vbYesNo
If (MsgBox(Msg, vbYesNo)) = vbYes Then
DoCmd.Close acForm, "frmRequest"
DoCmd.OpenForm "frmRequest"
Else
DoCmd.Close acForm, "frmRequest"
DoCmd.Quit acQuitSaveNone
End If
======================================================
Thanks!
-Amit
====================
Hello,
I have a form with a "Submit" button, that performs the following actions:
1. Emails a report based on the current record.
2. Asks the user if s/he wants to print a copy of the report.
3. Asks the user if s/he would like to submit a new request.
I'm using the following line of code to print the report:
=========================================
DoCmd.OpenReport "Request Report", acViewPreview
=========================================
With this line, I get the option to choose the printer, adjust margins etc.,
but the code doesn't wait for me to print the report, and displays the
report, and goes on to ask me if I want to submit a new request.
I've also tried:
===============================================
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection
===============================================
This code simply prints the report, without giving me the option to change
Printer settings.
What I'd like to happen is:
1. I get the option to choose/change printer, adjust margins etc. and then
print the report.
2. The messagebox that asks me to submit another request waits till I finish
printing.
I've done a lot of googling, and also checked the Help section, but have
been unable to find a solution. Will appreciate it if someone can point me in
the correct direction, or correct my code. Also, I'd rather not use the
DoMenuItem code.
Here's the code for actions 2. and 3.
==========================================================
If (MsgBox("Would you like to print a copy of this request?", vbYesNo) =
vbYes) Then
'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.PrintOut acSelection
DoCmd.OpenReport "Request Report", acViewPreview
End If
Dim Msg, Style As String
Msg = "Submit another request?"
Style = vbYesNo
If (MsgBox(Msg, vbYesNo)) = vbYes Then
DoCmd.Close acForm, "frmRequest"
DoCmd.OpenForm "frmRequest"
Else
DoCmd.Close acForm, "frmRequest"
DoCmd.Quit acQuitSaveNone
End If
======================================================
Thanks!
-Amit