E
Emine
I have a form that allows you to select one or several reports for preview by
using a command button. I want the Form that has the selection of reports to
automatically close after I've hit the print button.
Here is my code. What Event Procedure do I use?
Private Sub Report_Open(Cancel As Integer)
Dim Bar As Office.CommandBar
Dim Ctrl As Office.CommandBarControl
For Each Bar In Application.CommandBars
If Bar.Name = "Print Preview" Then
Bar.Visible = True
For Each Ctrl In Bar.Controls
If TypeOf Ctrl Is Office.CommandBarButton Then
If Ctrl.Caption = "&Print" Then
' instead of using captions you may use
' Ctrl.ID = 2521
' but i don't if its the same ID in all
' Access versions.
Ctrl.OnAction = "DoPrint"
End If
End If
Next Ctrl
End If
Next Bar
End Sub
with
Public Sub DoPrint()
End Sub
using a command button. I want the Form that has the selection of reports to
automatically close after I've hit the print button.
Here is my code. What Event Procedure do I use?
Private Sub Report_Open(Cancel As Integer)
Dim Bar As Office.CommandBar
Dim Ctrl As Office.CommandBarControl
For Each Bar In Application.CommandBars
If Bar.Name = "Print Preview" Then
Bar.Visible = True
For Each Ctrl In Bar.Controls
If TypeOf Ctrl Is Office.CommandBarButton Then
If Ctrl.Caption = "&Print" Then
' instead of using captions you may use
' Ctrl.ID = 2521
' but i don't if its the same ID in all
' Access versions.
Ctrl.OnAction = "DoPrint"
End If
End If
Next Ctrl
End If
Next Bar
End Sub
with
Public Sub DoPrint()
End Sub