Solved

Help with Message Box

Posted on 2000-02-20
3
210 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 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