DoCmd.Close

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I use this form to set the criteria for a Query that feed a report. I would
like to close this form after the report is open. I added the follwing and it
did not work:

Form name is: Qtr Loss LookUp FM

Dim stDocName1 As String
stDocName = "Qtr Loss LookUp FM"
DoCmd.Close stDocName1, nosave

and it did not work. any help would be great.

Keith

Private Sub Command21_Click()
On Error GoTo Err_Command21_Click

Dim stDocName As String

stDocName = "DEP Loss Qtr Rpt"

DoCmd.OpenReport stDocName, acPreview

Exit_Command21_Click:
Exit Sub

Err_Command21_Click:
MsgBox Err.Description
Resume Exit_Command21_Click

End Sub
 
Back
Top