Closing a popup

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
 
A

Albert D. Kallal

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?
 
T

Tony Williams

Thanks Albert. The strLinkCriteria was a leftover from "cutting and pasting"
Thanks for spotting it.
Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top