Kamis, 04 Desember 2014

Re: [MS_AccessPros] Command button to print multiple reports

 

Hmmm.  Easier said than done.  You can add a command button to do the Save As PDF on your report, but I can't see any way to change the folder before sending an Enter to cause the dialog to do its thing.


You could add a command button to your report to get the process started and name it cmdSaveAs and set the Caption to Save To PDF.  Set the Display When property to Screen Only so that it doesn't show up in the printed version.  Change the On Click property to [Event Procedure], then click the Build (…) button next to the property to open up a bit of code that will run when you click the button.  Change it to look like this:

Private Sub cmdSaveAs_Click()
    ' Open the Save As PDF dialog
    SendKeys "%FFP"
End Sub

The % is the same as pressing the Alt key.  Alt-F opens the File menu, F selects the Save As submenu, and P selects Save As PDF.

Someone else might have some ideas about how to change the folder location on the fly.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Dec 4, 2014, at 11:27 AM, Robin Chapple robinski@westnet.com.au [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John,

Yes that is correct.

Robin

At 4/12/2014 08:00 PM, you wrote:
 

Robin-

So once you have the report open you choose File / Save As, select PDF and a folder, then execute it?  Do you want to automate that?

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals

http://www.viescas.com/
(Paris, France)




On Dec 4, 2014, at 12:20 AM, Robin Chapple robinski@westnet.com.au [MS_Access_Professionals] < MS_Access_Professionals@yahoogroups.com> wrote:


John,

My first question mentioned that I needed to confirm print, confirm filename and confirm overprint of previous edition.

I have made a command button with the wizard for the first report
which asks for confirmation at the 'print' window, confirmation that
the filename is correct and confirmation to overprint the previous version.

Cheers,

Robin

At 4/12/2014 10:07 AM, you wrote:
Robin-

That's a simple OpenReport command to open the named report in Print Preview.  You said the code saved as a PDF, but that code isn't doing that.  Please explain.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals

http://www.viescas.com/
(Paris, France)




On Dec 3, 2014, at 11:47 PM, Robin Chapple robinski@westnet.com.au [MS_Access_Professionals] < MS_Access_Professionals@yahoogroups.com> wrote:


OOOPS! Sorry. When I loaded it there was so much debris that I 'tidied up'.  It is back now,

Robin

At 4/12/2014 09:00 AM, you wrote:
 

Robin-

Following that link got me:




HTTP Error 404.0 - Not Found










The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.









John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals

http://www.viescas.com/
(Paris, France)




On Dec 3, 2014, at 10:39 PM, Robin Chapple robinski@westnet.com.au [MS_Access_Professionals] < MS_Access_Professionals@yahoogroups.com> wrote:


Thanks John,

It was an embedded macro. Illustrated in that link,

Cheers,

Robin

At 4/12/2014 07:59 AM, you wrote:
 

Robin-

What did the Wizard create?  Open your form in Design View, select the command button, then look at the Properties window to see what's in the On Click property.  If it's [Event Procedure], select the property and then click the Build button (…) to see the code and then copy and paste the code back in a reply.  If it says [Embedded Macro], then select the property, click the Build button, and tell us what it says in the Macro Builder.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals

http://www.viescas.com/
(Paris, France)




On Dec 3, 2014, at 9:47 PM, Robin Chapple robinski@westnet.com.au [MS_Access_Professionals] < MS_Access_Professionals@yahoogroups.com> wrote:


Thanks John,

At 3/12/2014 07:19 PM, you wrote:

Are you using VBA or an embedded macro to run the reports? If VBA (recommended), what is your code?

I have only made the button with the wizard. I have very little VBA experience. Pressing Enter would be acceptable for each dialog. I do not have the expertise to produce the VBA.

Robin

If you are using VBA and you are willing to accept the "default" button (what would happen if you just pressed Enter on each dialog) on each of the dialog boxes, a DoCmd.SetWarnings False might work for you. If the overprint dialog doesn't have overwrite as the default, then you can add code to find out if the file exists and delete the file before running the code to avoid the dialog.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

On Dec 3, 2014, at 6:24 AM, Robin Chapple robinski@westnet.com.au [MS_Access_Professionals] < MS_Access_Professionals@yahoogroups.com> wrote:

I am using Access 2103. The database is a telephone directory. I have
five reports that need to be printed each time the data is changed.

I have made a command button with the wizard for the first report
which asks for confirmation at the 'print' window, confirmation that
the filename is correct and confirmation to overprint the previous version.

My questions are:

i) can I add the 'yes' to each within the command button routine?

ii) can I have all five reports printed from the one button.

Paper is not a concern because the output is to PDF.

Thanks,

Robin Chapple

------------------------------------
Posted by: Robin Chapple <robinski@westnet.com.au >
------------------------------------

------------------------------------

Yahoo Groups Links


__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (12)

.

__,_._,___

Tidak ada komentar:

Posting Komentar