Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
Code:
Private Sub cmbSDPFLine_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim rtn_ans1 As String
If cmbSDPFLine.Value = "" Then
rtn_ans1 = MsgBox("Please select a production line.", vbOKOnly, "Please Select Production Line")
Select Case rtn_ans1
Case 1
Cancel = True
cmbSDPFLine.SetFocus
End Select
End If
End Sub
Code:
Private Sub cmdbtnCancel_Click() Unload Me
End Sub
The problem that I am having is if the user wants to cancel out of the form without making a selection, and clicks the Cancel Button, the above message box keeps displaying until the user makes a selection and then clicks the cancel button. Also if the user clicks on the white "X" with the red background on the form the message box also displays but once the user acknowledges the OK button the form closes. So what I like is once the user clicks on the white X or the clicks the cancel button I need the form to close without displaying the message box. How can I achieve this? Thank You.