Results 1 to 4 of 4
  1. #1
    GinaFlan is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Location
    Texas
    Posts
    68

    Is there a way to nest these?

    If IsNumeric(Me.TxtActualBenchmark) = "False" _
    And txtBenchmarks.Value = "1 promotion per month" Then
    Me.TxtActualBenchmark.Undo


    MsgBox "Please enter a numeric value ", _
    vbInformation, "Missing Information"
    Exit Sub
    End If
    If InStr(Me.TxtActualBenchmark, ".") = 0 And Me.txtBenchmarks.Value = ".02% increase monthly" Then
    MsgBox "Please enter a decimal", vbInformation, "Missing Information"
    Cancel = True
    Exit Sub
    End If

    If InStr(Me.TxtActualBenchmark, ".") = 0 And Me.txtBenchmarks.Value = "89 percent of free and reduced applications measured at month end" Then
    MsgBox "Please enter a decimal", vbInformation, "Missing Information"
    Cancel = True
    Exit Sub
    End If

    If IsNumeric(Me.TxtActualBenchmark) = "False" _
    And txtBenchmarks.Value = "Less than 20 student complaints per month" Then
    Me.TxtActualBenchmark.Undo
    MsgBox "Please enter a numeric value ", _
    vbInformation, "Missing Information"
    Exit Sub
    End If
    If IsNumeric(Me.TxtActualBenchmark) = "False" _
    And txtBenchmarks.Value = "Less than 20% negative ballots or staff observations" Then
    Me.TxtActualBenchmark.Undo
    MsgBox "Please enter a numeric value ", _
    vbInformation, "Missing Information"
    Exit Sub
    End If
    If IsNumeric(Me.TxtActualBenchmark) = "False" _
    And txtBenchmarks.Value = "At least one program every 6 months" Then
    Me.TxtActualBenchmark.Undo
    MsgBox "Please enter a numeric value ", _
    vbInformation, "Missing Information"
    Exit Sub
    End If
    If IsNumeric(Me.TxtActualBenchmark) = "False" _
    And txtBenchmarks.Value = "No findings" Then
    Me.TxtActualBenchmark.Undo
    MsgBox "Please enter a numeric value ", _
    vbInformation, "Missing Information"
    Exit Sub
    End If
    If IsNumeric(Me.TxtActualBenchmark) = "False" _
    And txtBenchmarks.Value = "No negatives" Then
    Me.TxtActualBenchmark.Undo
    MsgBox "Please enter a numeric value ", _
    vbInformation, "Missing Information"
    Exit Sub
    End If

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    At least, more readable...

    Code:
    Dim vMsg
    
    Select Case True
        Case IsNumeric(TxtActualBenchmark) = False And txtBenchmarks.Value = "1 promotion per month"
            vMsg = "Please enter a numeric value "
        
        Case InStr(TxtActualBenchmark, ".") = 0 And txtBenchmarks.Value = ".02% increase monthly"
           vMsg = "Please enter a decimal"
        
        Case InStr(TxtActualBenchmark, ".") = 0 And txtBenchmarks.Value = "89 percent of free and reduced applications measured at month end"
           vMsg = "Please enter a decimal"
        
        Case IsNumeric(TxtActualBenchmark) = False And txtBenchmarks.Value = "Less than 20 student complaints per month"
            vMsg = "Please enter a numeric value "
        
        Case IsNumeric(TxtActualBenchmark) = False And txtBenchmarks.Value = "Less than 20% negative ballots or staff observations"
            vMsg = "Please enter a numeric value "
        
        Case IsNumeric(TxtActualBenchmark) = False And txtBenchmarks.Value = "At least one program every 6 months"
            vMsg = "Please enter a numeric value "
        
        Case IsNumeric(TxtActualBenchmark) = False And txtBenchmarks.Value = "No findings"
            vMsg = "Please enter a numeric value "
        
        Case IsNumeric(TxtActualBenchmark) = False And txtBenchmarks.Value = "No negatives"
            vMsg = "Please enter a numeric value "
    End Select
    
    If vMsg <> "" Then
      TxtActualBenchmark.Undo
      MsgBox vMsg, vbInformation, "Missing Information"
    End If

  3. #3
    GinaFlan is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Location
    Texas
    Posts
    68
    Ok wonderful thank you

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Copy/paste code within CODE tags and it will be more legible to readers, assuming you have used indentation in your code. Click the CODE icon on the post editor toolbar.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Nest query
    By seanwd in forum Queries
    Replies: 0
    Last Post: 06-18-2014, 02:14 PM
  2. Replies: 2
    Last Post: 07-12-2013, 06:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums