Don't print buttons on Form

w1fini

Registered User.
Local time
Tomorrow, 04:07
Joined
Nov 4, 2009
Messages
19
Hi,

I have a form with some controlls containg data and other implementing functionality (like save, search etc.)

I would like to give the user the possibility to print the form but without the funtionality controlls as they dont provide any value to a printout. ;)

Controlls with functionality are all in the form footer. Thus if there is a possibility to prevent the footer to be printed that would help a lot.

I was looking into the form properties but I could not find anything related. I would appreciate every suggestions. Thanks a lot.
 
Last edited:
Simply set the Visibility of the buttons to False prior to the print command and then return the Visibility to True after the print command.
Code:
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click

    Dim stDocName As String
    Dim MyForm As Form
    
    [COLOR="Magenta"]Me.Command9.Visible = False[/COLOR]

    stDocName = "FRM_Name"
    Set MyForm = Screen.ActiveForm
    DoCmd.SelectObject acForm, stDocName, True
    DoCmd.PrintOut
    DoCmd.SelectObject acForm, MyForm.Name, False
    
    [COLOR="Magenta"]Me.Command9.Visible = True[/COLOR]

Exit_Command10_Click:
    Exit Sub

Err_Command10_Click:
    MsgBox Err.Description
    Resume Exit_Command10_Click
    
End Sub
 
I have found that form really are not great for printing at all. Report are great fort this.

I would urge you to0 create a report and then use a button on the form to print the current report with a report.

TIP: You can event save a form as a report. You can then remove what you do not want to print.

TIP 2: You can copy and paste all the controls form a form onto a report.


See:
How to Print a Single Record from a Form in a Report

Hope this helps ...
 
Naturally, I'd agree that reports are for printing, forms for onscreen working with data.
None the less, Microsoft have allowed for your requirement.
For the controls you don't want to see, set their "Display When" property to "Screen Only".
(You can do that simultaneously of course - selecting all controls you want at once and setting that property for all of them).

Cheers.
 
I agree, that is no good to print a form - as it is not the purpose of a database to print everything. But you know how users are. Sometimes they to want to hold something physically in their hands.

The differenz between forms and reports is that reports are populating a mass display of data.
But it apears difficult to me display a single data in a nice format that differs from showing a single tablerow.
I have had enough trouble to make the form look nice. I dont want to put more time into making a report look nice if the form that is already in shape.

Thus Screen only is the perfect solution for me. Now I need to explain the users to hit the "print selected record" only button...or is there some way to make the option pre selected?
 
Simply set the Visibility of the buttons to False prior to the print command and then return the Visibility to True after the print command.
Code:
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click

    Dim stDocName As String
    Dim MyForm As Form
    
    [COLOR="Magenta"]Me.Command9.Visible = False[/COLOR]

    stDocName = "FRM_Name"
    Set MyForm = Screen.ActiveForm
    DoCmd.SelectObject acForm, stDocName, True
    DoCmd.PrintOut
    DoCmd.SelectObject acForm, MyForm.Name, False
    
    [COLOR="Magenta"]Me.Command9.Visible = True[/COLOR]

Exit_Command10_Click:
    Exit Sub

Err_Command10_Click:
    MsgBox Err.Description
    Resume Exit_Command10_Click
    
End Sub

isn't there a "print" property for controls on forms? I thought there was always an option to print the control or not. is that not right? I know it is for some of them at least.
 
isn't there a "print" property for controls on forms? I thought there was always an option to print the control or not. is that not right? I know it is for some of them at least.

You learn something every day :o There is a property Display When, which can be set to; Always, Print Only or Screen Only. How simple is that? No need to piss around with code :rolleyes:
 
Hi

I finally found the solution to only print the selected record:

Function PrintRecord()
'This procedure selects the current record and prints it.
RunCommand acCmdSelectRecord
DoCmd.PrintOut acSelection
End Function

It sets the focus to the selected record and runs the print.

Hope that helps me also with the problem of loosing the focus in the form after saving/copying data to excel:
http://www.access-programmers.co.uk/forums/showthread.php?t=182523
 

Users who are viewing this thread

Back
Top Bottom