?
Solved

Help with Message Box

Posted on 2000-02-20
3
Medium Priority
?
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
fibdev earned 60 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

777 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