AfterUpdate property not working.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • azkhan
    New Member
    • Nov 2013
    • 5

    AfterUpdate property not working.

    I have a form on which i use a combobox and use Afterupdate
    property on it..when i select value in combobox than relating fields changes its value...

    After that i use afterupdate property to another combobox and put the code in event section of afterupdate property.The code is below.
    //////////////////////////////////////////////
    Code:
    Private Sub Status_AfterUpdate()
    
    Select Case Me.Status
      Case "Closed", "Resolved"
        CloseDate.Visible = True
      Case Else
        CloseDate.Visible = False
      End Select
      
    End Sub
    ////////////////////////////////////////////////
    when i have added above code than nothing changes on form. both afterupdate functions are not working.even i deleted the above function but the previous property is also not working.
    kindly help me what i am doing wrong....

    Thanks
    Azhar Naeem
    Last edited by Rabbit; Nov 8 '13, 06:17 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
  • MikeTheBike
    Recognized Expert Contributor
    • Jun 2007
    • 640

    #2
    Hi

    First, in design view, open the Status Combobox property sheet and check that the After Update event is set to [Event Procedure]

    If that is not the probelm I suggest you try adding a break point in the event code and step through the code checking the values to try and understand what is happening (assuming it runs tne code !).

    HTH


    MTB

    Comment

    • jimatqsi
      Moderator Top Contributor
      • Oct 2006
      • 1290

      #3
      I would add that it might be a good idea to set breakpoints in all events on the form; you sometimes get surprised by some event changing the sequence from what you expect.

      Jim
      Last edited by NeoPa; Nov 9 '13, 05:14 PM. Reason: No changes - Just a note to explain that, though this post is helpful, it doesn't answer the question so cannot be set as Best Answer. Sorry.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32636

        #4
        An alternative to that code, with the same effect, might be :
        Code:
        Private Sub Status_AfterUpdate()
            With Me
                .CloseDate.Visible = (.Status In ("Closed", "Resolved"))
            End With
        End Sub

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32636

          #5
          Azhar did set Best Answer, but to a post that doesn't answer the question (Sorry about that Jim). For now I'll guess he found that the event properties of the controls were not set so found post #2 to answer the question.

          Comment

          • azkhan
            New Member
            • Nov 2013
            • 5

            #6
            I have sorted out the problem.Actuall y i am new in ms access VB development..th erefore i have done small mistakes.
            The mistake is that i am not accessing it through it "Me" that is.
            CloseDate.Visib le = True (Wrong)
            Me.CloseDate.Vi sible = True (Right)

            I am really thankfull to all who replied..specia lly NeoPa because his answer is very close to my problem.

            Thanks & Regards
            Azhar

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32636

              #7
              No. That is not true at all. I'm sorry.

              Using "Me." is good practice, but is certainly not the reason your code didn't work originally (as it certainly would work, even without using "Me.").

              Again, I cannot leave that post as Best Answer. It isn't even correct. I suspect (clearly I don't have any more information than previously) that the issue that stopped the original code from working was that the Event Properties were not set. Thus I will reassign MTB's post. Unless and until I hear that something else was the reason it was fixed.

              Again, sorry to have to do this, but having posts set as Best Answer that don't answer the question is not what the feature is there for.

              Comment

              Working...