How do I put the Print Record command on a custom tool bar?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can make a command button on the form that will print just the current
record,
how can I put this on a custom tool bar?
 
hi,
you can't put a button on a tool bar but you can create a
custom icon or menu item and assing the code to the custom
icon.
 
Sure, here is what you do:

Assuming you have the following code in your form to print the current
record:

me.refresh ' must write data to disk (report reads from table)
docmd.OpenReprot "MyReprot",acViewPreview,,"id = " & me!ID

The above code is likely what you used (you can remove the acViewPreview if
you want the report to print, and not preview).

So, take the above code in the form, and move it to a function in the form
like:


Public Function MyInvoicePrint()

me.refresh ' must write data to disk (report reads from table)
docmd.OpenReprot "MyReprot",acViewPreview,,"id = " & me!ID

end Function.

You can have the button code on the form (if you keep the button) go:

MyInvoicePrint

Now, build your custom tool bar, add a custom button, right click to get to
properties, and in the button on-action, simply put

=MyInvoicePrint()

You are done. So, you can quite easily have the menu bar, or tool bar call
code in the form.
 
Back
Top