Can a displayed field not be printed?

W

WhatsUpDoc

I display a recordon the screen and if the user wants to print the record,
there is a field I do not want to show on the printout (it's ok for the user
to see it but I don't want it passed around to others).

Is there some 'property' attached to the field that will allow it to be
displayed but not printed?

Thanks for your help.
 
R

Rick B

You print a report, not a form.

Build a report and do not include the field you mention.

Add a button to your form to print the report.

You can use code similar to the following to have the report print only the record you are viewing on the form...


Button to print specific record
Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field), you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with acViewNormal.



See also: http://allenbrowne.com/casu-15.html
 

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