custom toolbars

S

Simon

I have created a custom toolbar and put the standard print button on it.
This I thought was the equivalent of clicking, File and then Print.
However, when I click the icon it automatically prints to the default
printer. I want the option to specify a printer, number of copies etc as if
I had clicked File, Print. I noticed there is an Action option if I right
click the button in edit mode, do I need to write Visual Basic code for this
or is there perhaps another button which I have missed. If it does need code
does anyone know what this should be.
I am using Access 2003 and as ever will be most greatful of ay help.
 
V

Van T. Dinh

Use a Custom Command on your Custom ToolBar to run a public function which
has the statement:

DoCmd.RunCommand acCmdPrint

Don't use DoCmd.PrintOut. PrintOut will print to the default printer
without presenting the Print Dialog.
 
S

Simon

Van thats exactly what I needed thanks very much.
Just one other thing, is there anyway to only enable the print button if a
report is open and has the focus. The danger being that if someone sees the
information in a form that they want they may be tempted to just hit the new
print button. Most of my forms are open by linking criteria and what they
see on screen and what they could end printing would be very different.
Thanks again
Simon
 
V

Van T. Dinh

Are you using the same custom ToolBar for Forms, Reports, etc ...?

Each Form / Report can have a separate ToolBar using the Form's / Report's
ToolBar Property.

If you want to use the same ToolBar, try adding the Office Object Library
into the References Collection of your database and checked out the Enabled
Property of the CommandBarButton object.
 
S

Simon

Thanks again for your response Van.
I have set the toolbar within each report. (your final paragraph scared the
pants off me!!) I am sure this isn't the correct way to do this but for the
minute it works and I will investigate your comments in the final paragraph
when I get a chance.
 
V

Van T. Dinh

Either way is fine. If fact, setting the ToolBar Property for each Report
is probably (???) the more correct method.

It is always good to get what you need works first and then review to see if
any improvements can be made later.

Glad I could assist ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top