View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Michael Malinsky[_3_] Michael Malinsky[_3_] is offline
external usenet poster
 
Posts: 45
Default Controlling Input

The first occurence of the message box happens when someone enters a number
as the first "character." The second occurence is due to you again changing
the text box with the command:

TextBox1.Text=""

which fires the change event a second time due to Len(TextBox1.Text) not
being greater than zero.

I changed the code to the following:
------------------------------------
If Len(TextBox1.Text) 0 And IsNumeric(VBA.Left(TextBox1.Text, 1)) =
False Then

------------------------------------
If Len(TextBox1.Text) = 0 And IsNumeric(VBA.Left(TextBox1.Text, 1)) =
False Then

------------------------------------

HTH

--
Michael J. Malinsky
Pittsburgh, PA

"I am a bear of very little brain, and long
words bother me." -- AA Milne, Winne
the Pooh
"Cameron" wrote in message
...
Hi all,

Am all most finished my MedEx XLS and found troubles when trying to delete
rows that had a numeric character as the first character (Unsure why).

Regardless, I figured that to ensure some protocol, the first character
could NOT be a numeric character.

The following code works, but it calls the TextBox1_Change() when I

attempt
to alter its value. This results in the MsgBox appearing twice.

Any suggestions to solve this apreciated.

TIA
Cameron
-----------------------------------------------------------
Code:
Private Sub TextBox1_Change()
If Len(TextBox1.Text) 0 And IsNumeric(VBA.Left(TextBox1.Text, 1)) =
False Then
If Len(TextBox2.Text) 0 Then
If Len(TextBox3.Text) 0 Then
ContinueButton.Enabled = True
Else
ContinueButton.Enabled = False
End If
Else
ContinueButton.Enabled = False
End If
Else
MsgBox "Docors Names generally don't start with numbers.", _
vbOKOnly, "Incorrect Details !!"
TextBox1.Text = ""
TextBox1.SetFocus
ContinueButton.Enabled = False
End If
End Sub
-----------------------------------------------------------