Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exit Function and MsgBox

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
My code is below, my problem is that I'm recieving two consecutive message boxes, when I only want one. I know the code is a little screwy but I've been playing with is trying to figure this out. Any suggestions?

Thanks

Function CustomerID_Blur()
CustomerID_Blur = False
If frmMain.CustomerID.Value <> &quot;&quot; then
If Len(frmMain.CustomerID.value) <> 15 Then
msgbox &quot;CustomerId must be 15 digits.&quot;, vbcritical, &quot;Intell-A-Check&quot;
Exit Function
Else
If Not IsNumeric frmMain.CustomerID.value) then
msgbox &quot;CustomerId must be 15 digits.&quot;, vbcritical, &quot;Intell-A-Check&quot;
Exit Function
Else
CustomerID_Blur = True
Exit Function
End If
End If
Else
Exit Function
End If

End Function
 
Ooops, I forgot to add that this doesn't happen on the Blur it happens when the Submit routine calls the blur.

Thanks - Lokiette
 
You don't need to use &quot;Exit function&quot;. because your If statements are correctly written then it should flow the end of the function anyway. You're only as good as your last answer!
 
is another object getting focus when the submit calls the blur. because then when the object loses focus it calls the blur function and when another object calls the blur function it will run again (twice) Post more code so I have more of an Idea of what you are trying to do.

Klae You're only as good as your last answer!
 
Actually I figured out that the calling routine was calling it twice.

It was calling the function:

CustomerID_Blur()

Then evaluating it, and calling it again:

if CustomerID_Blur = False then ....

But thanks for your help!

Lokiette
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top