Solved

How to view and alter an embededed macro

Posted on 2009-05-12
4
320 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 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