Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open report command button

Status
Not open for further replies.

Janet95

Technical User
Jun 6, 2006
45
US
Hi, I posted this question in the reports forum,but I think it belongs here.

I have a subform that has a command button that is used to open and run a report, only for the specific record shown. The problem is that when I press the command button the report shows behind the form so I can't see it. I've tried to make the form/subform invisiable but it doesn't work. The other reports that I have on a switchboard/reports menu form work fine. When I run those the reports menu form is hidden and the report is shown.

I basically want to hide both the main form and it's subform when the report opens, then when the report closes reopen/make them visable again.

The main form is named frmDivaProfile
the subform is named partnerLinkSubform

here's the code for the command button on the subform

Code:
Private Sub cmdOpenrptDivaAssignments_Click()
On Error GoTo Err_cmdOpenrptDivaAssignments_Click


    Me.Refresh
    
    
    Dim stDocName, stlink As String
    stDocName = "rptdiva_assignments_single"
    stlink = "IDDiva = forms!frmDivaProfile!txtID"

    DoCmd.OpenReport stDocName, acPreview
    
    
    
    Me.DivaID.SetFocus
    Me.Visible = False
    
    Me.Refresh
    

    
   
Exit_cmdOpenrptDivaAssignments_Click:
    Exit Sub

Err_cmdOpenrptDivaAssignments_Click:
    MsgBox Err.Description
    Resume Exit_cmdOpenrptDivaAssignments_Click
    
End Sub

Please help, thanks [ponytails2]
 
How about minimizing the main form when your report is open.

DoCmd.Minimize



And then when close your report open your form once again.

Private Sub Report_Close()
DoCmd.OpenForm "frmName"

End Sub
 
Thank you soooo much!!!

I'll give that I try and let you know if it works.

[sunshine]
 
Hey, I'm no expert but it's probably because you need to make the active form invisible - which would include the subform.

Screen.ActiveForm.Visible = False

this might help.
 
Thank you everyone for your help.

I used the DoCmd.Minimize command.

I had to put that code first/before opening my report, but it worked!!!

Thanks again everyone [sunshine]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top