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

    AfterUpdate month selected populate results with N/A but only works if I change the month from orig

    I need Results (TxtActualBenchmark) to be populated with "N/A" for certain months selected (but it doesn't work for the month selected) it only works once you change the month from your orignal choice. I am suppose to put the form on the server today. If anyone can help!!!!!



    Private Sub ComboMonth_AfterUpdate()
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "January" Then
    Me.TxtActualBenchmark = "N/A"


    Exit Sub
    End If

    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "February" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "March" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "April" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "May" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "July" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "August" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "September" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "October" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "At least one program every 6 months" And Me.ComboMonth = "November" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "January" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "February" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "March" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "May" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "June" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "July" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "September" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "October" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    If Me.txtBenchmarks.Value = "25% Implemented every 4 months" And Me.ComboMonth = "November" Then
    Me.TxtActualBenchmark = "N/A"
    Exit Sub
    End If
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What do you mean "but it doesn't work for the month selected"? Do you mean when the form opens to existing record? Run this code in the form OnCurrent event.

    Make the posted code a procedure in the form module:

    Sub SetBenchmark()
    ...
    End Sub

    The call that Sub in other procedures, such as the OnCurrent or combobox AfterUpdate:

    Sub Form_Current()
    SetBenchmark
    End Sub

    Sub ComboMonth_AfterUpdate()
    SetBenchmark
    End Sub
    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.

  3. #3
    GinaFlan is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Location
    Texas
    Posts
    68
    ok Thank you. I put it under comboGoal update and it worked

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    BTW, all of those IF statements can be shortened to:
    Code:
    Private Sub ComboMonth_AfterUpdate()
    
        Select Case Me.txtBenchmarks
            Case "At least one program every 6 months"
                Select Case Me.ComboMonth
                    Case "January", "February", "March", "April", "May", "July", "August", "September", "October", "November"
                        Me.TxtActualBenchmark = "N/A"
                    Case "June", "December"
                        'do nothing
                End Select
    
            Case "25% Implemented every 4 months"
                Select Case Me.ComboMonth
                    Case "January", "February", "March", "May", "June", "July", "September", "October", "November"
                        Me.TxtActualBenchmark = "N/A"
                    Case "April", "August", "December"
                        'do nothing
                End Select
    
        End Select
    
    End Sub

  5. #5
    GinaFlan is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Location
    Texas
    Posts
    68
    That would be so great. I will try. I have alot more to add I only have one departement finished. Thank you!!!!!

  6. #6
    GinaFlan is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Location
    Texas
    Posts
    68
    Perfect Thanks Again

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

Similar Threads

  1. Replies: 43
    Last Post: 08-06-2014, 08:21 PM
  2. Replies: 5
    Last Post: 06-17-2014, 12:11 AM
  3. Replies: 6
    Last Post: 05-05-2014, 10:51 PM
  4. Select Month from previous selected year
    By k0enf0rNL in forum Access
    Replies: 1
    Last Post: 01-15-2014, 12:14 PM
  5. Replies: 4
    Last Post: 05-26-2013, 03:28 PM

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