Odd Numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dawn123
    New Member
    • Nov 2009
    • 15

    Odd Numbers

    How would I use a IF statement only allowing even numbers..for example.
    I have a form that the user enters number, but the numbers can only be even, I want to be able to have it so if the users enters odd number then a message box come up saying an invalid number was eneted.. How would I go about doing this.. also only a number up to 70 can be added. Thanks
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    1. capture the key strokes.
    2. find the length.
    3. calculate the value.

    Comment

    • vb5prgrmr
      Recognized Expert Contributor
      • Oct 2009
      • 305

      #3
      Code:
      If Val(Text1.Text) > 70 Or Val(Text1.Text) Mod 2 <> 0 then
        MsgBox "Error: Either...
      End If


      Good Luck

      Comment

      Working...