Trying to validate data in a field on button click. Its not working...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Karli
    New Member
    • Nov 2010
    • 8

    Trying to validate data in a field on button click. Its not working...

    I want to confirm a number was entered before allowing the click to proceed. The click does work on its own but when I add the first If statement below it does not display the message....howe ver when I change to greater than (>), it does run the 1st message below when a number is entered. It just doesn't display the message when it is set to less than (<) and no number is entered.

    Private Sub Add_Work_Order_ __Click()

    If Me.Work_Order_N um < 1# Then

    MsgBox "You must enter a work order number for this request."

    End If

    Dim Msg As String
    Msg = "Have you confirmed all information is accurate?"
    If MsgBox(Msg, 32 + 4) = 6 Then
    SendKeys "%egw"
    DoCmd.GoToRecor d , , acNewRec

    End If
    End Sub
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Code:
    'Make sure that a Valid Number has been entered, and that it is >= 1
    If Not IsNumeric(Me.Work_Order_Num) Or Me.Work_Order_Num < 1 Then
      MsgBox "You must enter a work order number greater than 1 for this request."
    End If

    Comment

    • Jeff Karli
      New Member
      • Nov 2010
      • 8

      #3
      Thanks ADezii. I did get that working. Can you please look at my latest question? It's titled:
      "Problem copying from one record to another."
      Posted about an hour ago.

      Any help is appreciated.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        I believe that I already have, Jeff.

        Comment

        Working...