Disable print in form

Alhousani

Registered User.
Local time
Today, 23:30
Joined
Jan 3, 2005
Messages
15
Hi everybody,
I create a database and I want to add code to disable print in some form and enable in report and some other form so is there any way to do it since I need it to stop staff printing from form and enforce them to print from report.
 
The following Sub will open a specified form in design view, set all of the form sections' DisplayWhen property to Screen Only, then save the updated form:
Code:
Public Sub frmPrintDisable(frmName As String)

    Dim S As Long

    DoCmd.OpenForm frmName, acDesign

    For S = 0 To 4
        On Error Resume Next
        Forms(frmName).Section(S).DisplayWhen = 2 ' Screen Only
        On Error GoTo 0
    Next

    DoCmd.Close acForm, frmName, acSaveYes

End Sub

Call the Sub with something like:
Code:
frmPrintDisable "[b][i]MyForm[/i][/b]"

This will cause the printout of the specified form to appear blank. See if this works for you.
 
This is good but I want to disable print not print blank becasue i want to save the consumption of printer ink so if they print only in report that will be good.In addition some form I want to print since the colur of it is white and I want to allow them to print it.

Long time I saw this code in this forum but I forget under which title it is.
 
It's easy enough to do this by enabling/disabling toolbar commands, but that won't kill CTRL-P and so forth. You may want to investigate the OnPrint property, although that only applies to reports (as far as I remember).
 

Users who are viewing this thread

Back
Top Bottom