Solved

Help with Message Box

Posted on 2000-02-20
3
168 Views
Last Modified: 2010-05-02
I don't think that this is working the way it should and it will let me put text in the first box and after I enter a number in the second box it will have a message box come up and say enetr numbers only.  Is this correct or shouldn't it do it when I enetr text into (txtInputOne.Text) or is this correct???
Here is the code

     If IsNumeric(txtInputOne.Text) Then
           optAdd.Value = True Or optSubtract.Value = True Or optMultiply.Value           = True Or optDivide.Value = True
       Else
            MsgBox "Please Enter Numbers Only", vbOKOnly, "Invaild Data             Entered"
            txtInputOne.SetFocus
        End If
0
Comment
Question by:earth2d
3 Comments
 
LVL 3

Accepted Solution

by:
fibdev earned 20 total points
ID: 2540375
Try it this way:

Dim numOnly As String
numOnly = txtInputOne.Text

If IsNumeric(numOnly) = True Then
  optAdd.Value = True Or _
  optSubtract.Value = True Or _
  optMultiply.Value = True Or _
  optDivide.Value = True
Else
  MsgBox "Please Enter Numbers Only", vbOKOnly, "Invalid Data Entered"
  txtInputOne.SetFocus
End If

From what I can make of your question, that looks right (The message box part anyway.)
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2540381
It runs fine on my system.  I commented out the line after the if, but the rest works...
0
 

Author Comment

by:earth2d
ID: 2540603
Thanks it does work either way.  My way or your way.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now