Solved

Help with Message Box

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

809 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