Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to view and alter an embededed macro

Posted on 2009-05-12
4
Medium Priority
?
329 Views
Last Modified: 2013-11-28
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
Comment
Question by:petePrinter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:coffeeshop
ID: 24363179
"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
 

Author Comment

by:petePrinter
ID: 24364190
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
 
LVL 7

Accepted Solution

by:
coffeeshop earned 2000 total points
ID: 24365078
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
 

Author Closing Comment

by:petePrinter
ID: 31580441
coffeeshop
Thank you its fine
Regards
Pete
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question