|
-
Feb 1st, 2002, 09:24 AM
#1
Thread Starter
New Member
Problem with the Exit button in combination with txt_lostfocus event.
On a form i have a button to exit the form.
I have also several text controls on the form.
I have embeded validation code for the lostfocus event of the text controls.
My question is Is How can i bypass the evaluation of the code written within the text_lostfocus sub procedure when I click on the exit button.
Kindly indicate a suitable alternate method if the present approach is not feasible.
-
Feb 1st, 2002, 09:27 AM
#2
Use something like a cancel button, then in the LostFocus event, put
VB Code:
If Not (ActiveControl Is cmdCancel) Then
With Text1
'Perform data validation
End With
End If
-
Feb 1st, 2002, 09:30 AM
#3
Hyperactive Member
I had a similar problem.
there is no way to evaluate what the user clicked
to cause the LostFocus Event so you can't determine
whether the exit button is clicked. as a workaround
I evaluated the the Text Controls on the GotFocus event
by error checking the Text Control with the TabIndex prior
to the one getting focuss. did that make sense??
Example
VB Code:
Private Sub Text2_GotFocus()
If Me.Text1.Text = "" Then
MsgBox ("Enter a value for Text1")
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|