99% of the time the code is in the form, so you don't have to change
anything.
The only change you need to your button code is to make it a public
Function.
So, if you have a button on the current from to print the current record,
the code would look like:
me.Refresh ' force a disk write
docmd.OpenReport "invoice",acViewPreview,,"id = " & me!id
To move the above code to a button on a custom menu, we would change the
button code to:
PrintInvoice
And, then cut and past out the code right below to:
Public Function PrintInvoice
me.Refresh ' force a disk write
docmd.OpenReport "invoice",acViewPreview,,"id = " & me!id
end function.
Then, in the menu's on-action, you simply go:
=PrintInvoice()
All of the code for the button and form SHOULD and can remain in the current
form. There is NO reason to start re-writing the actual code, and changing
references like me. to forms!YourFormname. This is simply not required at
all.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com http://www.members.shaw.ca/AlbertKallal