button to print a form as a report. NEED HELP!!

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

Guest

Hello,

I want to create a button on a form that will print that form as report.


Is this possible?
 
I said:
Hello,

I want to create a button on a form that will print that form as report.


Is this possible?



Yes. You need a macro to open your report - then set the button to run
macro.


Hope this helps.

TLH
 
Hi,

Not strictly - a form and a report are two different types of object - you
cannot "print" a form as a report. You can print the form - using
docmd.RunCommand acCmdPrint - but don't, because printed forms look awful,
usually.

Instead, design a report that matches the form. If you're in a real hurry
some controls (textboxes, labels etc) can be copied and pasted from forms to
reports, retaining their relative positioning & sizes.

If you want the report to mirror the data the form is displaying (ie. on a
continuous form, or a form used to browse across multiple records, which the
user may filter) then create a report with an identical datasource property,
and when you open it use:

DoCmd.OpenReport "MyReport", acViewPreview, , Me.Filter

And the report will show the same records as the form is displaying. To
print a single record:

DoCmd.OpenReport "MyReport", acViewPreview, , "[primarykey]=" &
me.[primarykey]

Where [primarykey] is the primary key of the datasource that the form and
report are bound to.

You can change acViewPreview to acViewNormal to immediately print the report
using the Print Setup saved with the report.

Hope this is of some help.

Ben.

"I need immediate help!! Please"
 
Back
Top