N
noname
Hi,
I am stuck with a particular problem.
I have a form which has textboxes placed in a frame, which is placed
on 1st page of a multipage.
Whenever, i click the Red "X" on the form to unload the form, it
triggers the Exit event of the 1st Textbox on the form.
i have the following code in the Exit event of the Textbox. so it
triggers and runs that code, resulting in a message box. this
messagebox appears only after the form has unloaded. So its kind of
frustrating for me to track why its getting triggered by the
QueryClose Event of the form.
Form_QueryClose event code:
------------------------------------------
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
Cancel = False
Unload Me
frmCustomMsgBoxCross.Show
End If
End Sub
Textbox_Exit event code:
-----------------------------------
Private Sub txt_JobNo_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If txt_JobNo.Text = vbNullString Then
MsgBox "Please enter a Job No!", vbExclamation + vbOKOnly,
"Enter Job No"
Cancel = True
txt_JobNo.BackColor = RGB(255, 255, 0)
Else
txt_JobNo.BackColor = RGB(255, 255, 255)
End If
End Sub
Any ideas why its happening?
I am stuck with a particular problem.
I have a form which has textboxes placed in a frame, which is placed
on 1st page of a multipage.
Whenever, i click the Red "X" on the form to unload the form, it
triggers the Exit event of the 1st Textbox on the form.
i have the following code in the Exit event of the Textbox. so it
triggers and runs that code, resulting in a message box. this
messagebox appears only after the form has unloaded. So its kind of
frustrating for me to track why its getting triggered by the
QueryClose Event of the form.
Form_QueryClose event code:
------------------------------------------
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
Cancel = False
Unload Me
frmCustomMsgBoxCross.Show
End If
End Sub
Textbox_Exit event code:
-----------------------------------
Private Sub txt_JobNo_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If txt_JobNo.Text = vbNullString Then
MsgBox "Please enter a Job No!", vbExclamation + vbOKOnly,
"Enter Job No"
Cancel = True
txt_JobNo.BackColor = RGB(255, 255, 0)
Else
txt_JobNo.BackColor = RGB(255, 255, 255)
End If
End Sub
Any ideas why its happening?