Button to Open Form in Print Preview View

A

adna

I have a form that is essentially a letter, but the letter has to allow the
user to type in a custom paragraph, which is why I made the letter a form
instead of a report.

Anyway, I know that forms aren't really made to be printed but I want to do
this anyway if possible.

I want a button that opens the form in print preview. Anyone know how?

Thank you!
 
F

fredg

I have a form that is essentially a letter, but the letter has to allow the
user to type in a custom paragraph, which is why I made the letter a form
instead of a report.

Anyway, I know that forms aren't really made to be printed but I want to do
this anyway if possible.

I want a button that opens the form in print preview. Anyone know how?

Thank you!

A better solution than printing a form (which is not designed for
printing) is to create a report.
Include a label with the usual boilerplate text.
Then add an unbound text control where the added custom text is
supposed to go.
Set it's control source to:
=forms!FormName!ControlName
Set it's CanGrow property to Yes.
Also set the section the control is in to Can Grow Yes.
* Optional....Code the Report's Close event:
DoCmd.Close acForm "FormName"

Then add a command button to your form.
Code it's command button click event:
DoCmd.OpenReport "ReportName", acViewPreview

When ready to run the report open this form. Enter the wanted custom
text in the control.
Click the command button.
The Report will open and the boilerplate as well as the custom text
will be shown.
When you close the report, it will also close this form (if you have
added the optional code). Otherwise the form will remain open for
further use.
 
J

John W. Vinson

I have a form that is essentially a letter, but the letter has to allow the
user to type in a custom paragraph, which is why I made the letter a form
instead of a report.

Anyway, I know that forms aren't really made to be printed but I want to do
this anyway if possible.

I want a button that opens the form in print preview. Anyone know how?

Thank you!

You can actually get the best of both. Create a textbox on an unbound Form
into which the user can type their paragraph; let's call the form frmMyForm
and the textbox txtParagraph.

On the Report set the Control Source of a textbox to

=[Forms]![frmMyForm]![txtParagraph]

and put a command button on the form to launch the report.

John W. Vinson [MVP]
 

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