Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 330
  • Last Modified:

How to view and alter an embededed macro

Hi
i have a button on a form that prints and shows a report.
This was set up with the wizard.
I would like to alter the code to do the following.
1.Not show the form to the user.
2.Print two copies
3.Provide a message to the user that their reports have been sent to the printer.
I understand that i may be able to do some of this with the Docmd object but can not find the code sheet.
I can find the embeded macro that produces the report but not the code.
access 2007
Puescode
Open frmLetter not visable
print frmLetter copies:2
close frmLetter
Msgbox "Your Reports have been sent to the default Printer"

Open in new window

0
petePrinter
Asked:
petePrinter
  • 2
  • 2
1 Solution
 
coffeeshopCommented:
"Not show the form to the user" >> do you mean the user shouldn't see the report?

I assume your code shown is not the macro-code? What you want to do normally can be done with DoCmd.OpenReport. Does the following code works for you:
DoCmd.OpenReport "YourReport", acViewNormal
DoCmd.OpenReport "YourReport", acViewNormal
MsgBox "Your Reports have been sent to the default Printer"

Open in new window

0
 
petePrinterAuthor Commented:
coffeeshop
Thanks
i should have said report not form sorry.
Your code does not open the report but sends it to the printer.
I think the form open fires a macro when donefrom the form and runs the embedded macro.
I will latter make a clean form and try the above
i can directly open the form.

Were is the macro code stored please?
Regards
Pete
0
 
coffeeshopCommented:
Switch to the design mode of the form and open the properties, where you can change different form settings. Scroll down to "OnFormOpen". Here you see [Event Procedure] or [Macro], depending what executed if the event fires (if this is empty, there is no code behind). With a click to ... at the end of the line the macro or vba-editor opens for edit.

"Your code does not open the report but sends it to the printer." Yes - I wasn't sure if this is what you need - if not, please give me more information about what to do, I will  try to help you.
0
 
petePrinterAuthor Commented:
coffeeshop
Thank you its fine
Regards
Pete
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now