Toolbar Command Report

D

Debbie D.

Hi all,

First thanks for taking the time to read this. I have a report based on a
query. I know that I cannot add a active button as I can in form. However,
it is possible that I can add a command button to a toolbar or similar to
perform the following procedure:

Dim strType As String
Dim strName As String
strType = acOutputQuery
strName = "BCSNewRegistrations"
DoCmd.OutputTo strType, strName, acSpreadsheetTypeExcel9
MsgBox "British Computer Society Excel Registrations Data Created"

When I add a new button it mentions something about a new function I can
create. Any and all ideas welcome. Thanks again.

Debbie D.
 
6

'69 Camaro

Hi, Debbie.
When I add a new button it mentions something about a new function I can
create.

Place your code below in a public function in a standard module. It
_cannot_ be a sub. As soon as you've created your new button and placed it
on the toolbar, right-click the button and select Properties from the pop-up
menu. Add a caption and a helpful screen tip so anyone hovering the mouse
over the button can read what the button is. Next, select the On Action
combo box and type an equals sign, then the name of your function, then
opening and closing parentheses, without any spaces. For example:

=openNewQry()

Select the "Close" button to save your changes. Select the "Close" button
to close the Customize dialog window.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
D

Debbie D.

69 Camaro

Thanks for such a sweet and quick reply. Worked little a treat!

Debbie D.
 

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