Print a form with a heading represented by a controls value

  • Thread starter mark_jm via AccessMonster.com
  • Start date
M

mark_jm via AccessMonster.com

I am printing out a form. Its a sub form on a parent form.
The code looks as below, but I want to add the code to print a title on the
print out. The title is a string value in a control on the main form. Can
this be done?


Private Sub Command11_Click()
On Error GoTo Err_Command11_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "quality meeting wcf list_subform"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.name, False

Exit_Command11_Click:
Exit Sub

Err_Command11_Click:
MsgBox err.Description
Resume Exit_Command11_Click


Many thanks Mark

End Sub
 
T

Tom van Stiphout

On Tue, 17 Mar 2009 07:29:51 GMT, "mark_jm via AccessMonster.com"

This technique will print whatever is on the form. So if you added a
label on the form and set its Caption to your string, that would print
as well.

-Tom.
Microsoft Access 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