DoCmd.OpenReport is Printing

Breanna

Registered User.
Local time
Today, 07:50
Joined
Dec 29, 2014
Messages
49
I have a form with a button that I would like to open a report apon clicking. Right now when it is set up to open the query it does that just fine apon click. But when I change the VBA to open report it then prints the report when clicked and does not open it at all.

The form is set with a drop box and the button will open a specific query based on an option chosen from the dropbox.

This is the code I used to open the report when it prints instead. Am I missing anything? I do not have any commands to print So I am not sure why it keeps doing this.

Code:
Private Sub EmplSearchRButton_Click()

If IsNull(InformationDrop) Then
    MsgBox "Please choose Information Type"
    
    Else
        If ([InformationDrop] = "Contact") Then
        DoCmd.OpenReport "EmplSearchContactR"
    
    Else
        If ([InformationDrop] = "Emergency") Then
        DoCmd.OpenReport "EmplSearchEmergencyR"
        
    Else
        If ([InformationDrop] = "Company") Then
        DoCmd.OpenReport "EmplSearchCompanyR"
        
    Else
        If ([InformationDrop] = "Personal") Then
        DoCmd.OpenReport "EmplSearchPersonalR"
        
        
        End If
        End If
        End If
        End If
        
End If

End Sub

Is the OpenReport command set to print automatically? Any help is appreciated thank you.
 
OpenReport prints by default. If you look in help at its arguments, you'll see the one you can set to preview instead.
 

Users who are viewing this thread

Back
Top Bottom