One Command Button to SAVE then PRINT

PattyS

Registered User.
Local time
Today, 02:09
Joined
Jun 20, 2006
Messages
39
wanted to know if this is possible and if so
what would the code be behind the Command Button ?

can I have one button to save the subform data AND then print the REPORT
generated from the subform data
 
Sure -

To save and print immediately:
Code:
If Me.Dirty Then Me.Dirty = False
DoCmd.OpenReport "ReportNameHere", acViewNormal

To save and PREVIEW before printing:
Code:
If Me.Dirty Then Me.Dirty = False
DoCmd.OpenReport "ReportNameHere", acViewPreview
 
thank you Bob, will give that a try
I dont want a macro, I want a code but the macro builder thing comes up when I click on
the command button to install
 
thank you Bob, will give that a try
I dont want a macro, I want a code but the macro builder thing comes up when I click on
the command button to install

click on the button while in design view. Go to the EVENTS tab on the properties dialog and click in the CLICK event. A drop down should appear and you select [EVENT PROCEDURE] and then click the ellipsis (...) and it should open the VBA window and take you to the VBA event.
 
ok Bob, I usually do just that when I am putting in a code behind a field
On pervious versions of access, to put a command button on a form you would click on the command button and put it on the form and a wizard would come up and ask how you want this command button to work, simple
on 2010 version I could not find the wizard, had to ask BUT when I use it now, it makes a macro instead of code. (dont know jack about macros)
 
The Wizard creates Embedded Macros. If you use the Wizard you will get an embedded macro and you can't convert it to VBA. You would need to just unselect the Wizard option so that you can place your button and code it yourself OR you can just click the add button and then when the wizard comes up you can click CANCEL and the button will still be there but without anything so you can then add your own code.
 

Users who are viewing this thread

Back
Top Bottom