Using After update and Click in Access

  • I am trying to run this code below in an after update only if the user clicks on the cancel button. What code do I need to write so I know when the user clicks the cancel button only then the below code will run. HELP!

    DoCmd.SetWarnings False 'this gets rid of the standard msgbox from appearing.

    DoCmd.RunSQL "delete from tblClinician where ClinicianID = " & Me.ClinicianID

    DoCmd.SetWarnings True

    Me.Requery   'This code is now on the form after update property

    DoCmd.Close acForm, "frmAddClinician", acNormal

    DoCmd.OpenForm "frmSwitchboard", acNormal

     Regards

    Ritesh

  • Ritesh,

    I can't figure out why you would want this code in the After Update event. Why not just put it in the OnClick of the Cancel button itself?

    Regards

    David

  • Thanks for your help. I've managed to sort it out.

    i set a hidden text box and if that value came to 0 then the code would run.

     

    thanks

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply