Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    After Update (Access 2000)

    How can i recognize an AfterUpdate event?
    I have a command button called CmdExit

    where i want to put the folloiwng event:

    If customerid is chosen Then
    ' perform the function
    CancelOrderOnExit
    Else
    DoCmd.Close acForm, Me.Name


    CustomerId is a combo box from where i choose the customer.I want the function
    CancelOrderOnExit to be triggered
    only after i have chosen a customer.
    But i do not want to place it in the after udpate event of the customerid.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: After Update (Access 2000)

    The concept "customerid is chosen" does not make much sense. Do you mean that you want CancelOrderOnExit to be called if the combo box CustomerID is not blank?

  3. #3
    2 Star Lounger
    Join Date
    Apr 2005
    Location
    Plovdiv
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: After Update (Access 2000)

    Yes, that is what i meant. Exactly,i want that the function CancelOrderOnexit to be called if the combo box CustomerID is not blank
    Thank you

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: After Update (Access 2000)

    When you click a command button (cmdExit in your case) the cmdExit_click event occurs.

    When you update the value of CustomerID the CustomerID_AfterUpdate event occurs.

    If you want some code to execute when the CustomerID_AfterUpdate event occurs, you have the form open in Design view, look at the properties of the CustomerID combo, and find (In the event tab) the after update event. click in it and three dots appear. Click the dots (choose Code builder if asked.)

    The code in the afterupdate event is quite separate from the code in the cmdExit_click event.
    I am not sure that I fully understand what you need, but it looks to me like you don't actually need to use the afterupdate event. Instead I think that in your code for CmdExit, you just want to check whether a customer has been selected.

    If not isnull(me!customerID) then
    ' perform the function
    CancelOrderOnExit
    Else
    DoCmd.Close acForm, Me.Name
    end if
    Regards
    John



  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: After Update (Access 2000)

    Try this:

    If Not IsNull(Me.CustomerID) Then
    ' perform the function
    CancelOrderOnExit
    Else
    DoCmd.Close acForm, Me.Name
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •