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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

close report code

Status
Not open for further replies.

sdimaggio

Technical User
Jan 23, 2002
138
US
To open a report using a button on a form i use the following code:

Private Sub Command47_Click()
On Error GoTo Err_Command47_Click

Dim stDocName As String

stDocName = "rpt_PlantProfiles"
DoCmd.OpenReport stDocName, acPreview

Exit_Command47_Click:
Exit Sub

Err_Command47_Click:
MsgBox Err.Description
Resume Exit_Command47_Click

End Sub
_____________________________________

I am trying to make a button on the same form that when clicked on it will close the report if it is open.

I sure could use some help on the code.

Many thanks!

 
Hi
This seems to work:
Code:
Private Sub cmdCloseReport_Click()
On Error GoTo Err_CloseReport_Click

    Dim stDocName As String

    stDocName = "Members1"
    DoCmd.Close acReport, stDocName

Exit_CloseReport_Click:
    Exit Sub

Err_CloseReport_Click:
    MsgBox Err.DESCRIPTION
    Resume Exit_CloseReport_Click
    
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top