surfbum3000
Technical User
I have two forms: frmSearchDept and F_Search. When I open the frmSearchDept and click the X in the right hand corner, a message appears "Close the form?" with Yes/No. This works fine.
-----------------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Close the form?", vbYesNo) = vbNo Then
Cancel = True
Me![cboDept].SetFocus
End If
End Sub
The problem is on the F_Search form. When I click on a command button to open the frmSearchDept it opens fine. Then when I click on the X in the right hand corner, the following occurs: "Close the form?" with Yes/No. Click Yes. This is good so far but then I get a Enter Parameter Value titled Forms!frmSearchDept!cboDept. Click on Cancel and another message appears "The OpenReport action was canceled".
I want to eliminate the Enter Parameter Value window and just close the frmSearchDept.
The command button named cmdDeptSelect has the following under On Click:
--------------------------------------------
Private Sub DeptSelect_Click()
On Error GoTo Err_Loc_Click
Dim stDocName As String
stDocName = "rptSearchDept"
DoCmd.OpenReport stDocName, acPreview
Exit_Loc_Click:
Exit Sub
Err_Loc_Click:
MsgBox Err.Description
Resume Exit_Loc_Click
End Sub
-----------------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Close the form?", vbYesNo) = vbNo Then
Cancel = True
Me![cboDept].SetFocus
End If
End Sub
The problem is on the F_Search form. When I click on a command button to open the frmSearchDept it opens fine. Then when I click on the X in the right hand corner, the following occurs: "Close the form?" with Yes/No. Click Yes. This is good so far but then I get a Enter Parameter Value titled Forms!frmSearchDept!cboDept. Click on Cancel and another message appears "The OpenReport action was canceled".
I want to eliminate the Enter Parameter Value window and just close the frmSearchDept.
The command button named cmdDeptSelect has the following under On Click:
--------------------------------------------
Private Sub DeptSelect_Click()
On Error GoTo Err_Loc_Click
Dim stDocName As String
stDocName = "rptSearchDept"
DoCmd.OpenReport stDocName, acPreview
Exit_Loc_Click:
Exit Sub
Err_Loc_Click:
MsgBox Err.Description
Resume Exit_Loc_Click
End Sub