Solved

How to view and alter an embededed macro

Posted on 2009-05-12
4
319 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
  • 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 500 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now