Closing a popup

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have a popup form that asks for criteria before opening another form. My
code is
Private Sub cmdFindDocs_Click()
On Error GoTo Err_cmdFindDocs_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmMeetingPapers1"

If IsNull(Me.mtgcommtxt) Then MsgBox "Please enter Group Code"
Me.mtgcommtxt.SetFocus
Cancel = True
If IsNull(Me.MtgDatetxt) Then MsgBox "Please enter Meeting Date"
Me.mtgcommtxt.SetFocus
Cancel = True
If Not IsNull(MtgDatetxt) And Not IsNull(mtgcommtxt) Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

Exit_cmdFindDocs_Click:
Exit Sub

Err_cmdFindDocs_Click:
MsgBox Err.Description
Resume Exit_cmdFindDocs_Click
End Sub

However when the other form opens I want the popup to close automatically. I
added DoCmd.Close at the end of the code but this didn't work. Can anyone
help?
Tony
 
Anyway, you can do:

DoCmd.OpenForm stDocName, , , stLinkCriteria
docmd.Close acForm, me.name

I did also notice that you did not set strLinkCritera?

Did you leave that part out by accident?
 
Thanks Albert. The strLinkCriteria was a leftover from "cutting and pasting"
Thanks for spotting it.
Tony
 
Back
Top