[AccessD] How To Stop Printing

jeffrey.demulling at usbank.com jeffrey.demulling at usbank.com
Wed Jan 29 15:22:01 CST 2003


If you want you can hide the menu and toolbars with code like this on the 
Forms on open event

hideCommandBars
DoCmd.ShowToolbar "Unassigned_BM_Loans_Forms", acToolbarYes
DoEvents

Place this code in a module:
Sub hideCommandBars()
    Dim cbr As CommandBar
    For Each cbr In CommandBars
        hidebar cbr
    Next cbr
End Sub

Sub listbar(level As Integer, thisbar As CommandBar)
    Dim cbrctl As CommandBarControl
    Dim indent As Integer
    ' Indent the command bar depending on its level in
    ' the menu structure.
    For indent = 1 To level
        'MsgBox "   "
    Next indent
    Select Case thisbar.Type
        Case msoBarTypeMenuBar
            MsgBox "Menu Bar: " & thisbar.name
        Case msoBarTypeNormal
            MsgBox "Toolbar: " & thisbar.name
        Case msoBarTypePopup
            MsgBox "Popup: " & thisbar.name
    End Select
    For Each cbrctl In thisbar.Controls
    ' If the control doesn't have a command bar associated
    ' with it, then don't print it.
        If cbrctl.Type <> 1 And cbrctl.Type <> 2 _
              And cbrctl.Type <> 4 And cbrctl.Type <> 16 _
              And cbrctl.Type <> 18 Then
            listbar level + 1, cbrctl.CommandBar
        End If
    Next cbrctl
End Sub
Sub hidebar(thisbar As CommandBar)
    Dim cbrctl As CommandBarControl
    Dim indent As Integer
    ' Indent the command bar depending on its level in
    ' the menu structure.
    'For indent = 1 To level
        'MsgBox "   "
    'Next indent
    Select Case thisbar.Type
        Case msoBarTypeMenuBar
            DoCmd.ShowToolbar thisbar.name, acToolbarNo
        Case msoBarTypeNormal
            DoCmd.ShowToolbar thisbar.name, acToolbarNo
        Case msoBarTypePopup
            DoCmd.ShowToolbar thisbar.name, acToolbarNo
    End Select
    'For Each cbrctl In thisbar.Controls
    ' If the control doesn't have a command bar associated
    ' with it, then don't print it.
        'If cbrctl.Type <> 1 And cbrctl.Type <> 2 _
              And cbrctl.Type <> 4 And cbrctl.Type <> 16 _
              And cbrctl.Type <> 18 Then
            'listbar level + 1, cbrctl.CommandBar
        'End If
    'Next cbrctl
End Sub

I also include the following in a module to get the menu and toolbars 
back:
Sub showdefaultbar()
DoCmd.ShowToolbar "Database", acToolbarYes
DoCmd.ShowToolbar "Menu Bar", acToolbarYes

End Sub

Hope this helps





"Rocky Smolin - Beach Access Software" <bchacc at san.rr.com>
Sent by: accessd-admin at databaseadvisors.com
01/29/2003 02:00 PM
Please respond to accessd

 
        To:     AccessD at databaseadvisors.com
        cc: 
        Subject:        [AccessD] How To Stop Printing


Dear List:
 
I have a user who, instead of printing the report which is attached to a 
button on a bound form, will hit the printer icon on the toolbar or click 
File-->Print and, of course, gets 200+ pages because it's printing all the 
records attached to the bound form. 
 
He admits it's a bonehead thing to do but wonders if there's a way to 
prevent him from doing that (be serious, now).
 
Is there a way to stop that?
 
MTIA
 
Rocky Smolin
Beach Access Software
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030129/351ec704/attachment-0002.html>


More information about the AccessD mailing list