Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   "Cancel" Action - Reason required (https://www.askmehelpdesk.com/showthread.php?t=800335)

  • Aug 29, 2014, 02:08 AM
    ecanestrari
    "Cancel" Action - Reason required
    Hi there,

    I have different forms that are linked to one table (tblDeals) in which I have several fields but in this case I'm interested in two of them ("Status" and "Reason").

    On the forms I have a combo box with two values: "Active" and "Cancelled". What I want is that when the "Status" is changed a pop up message appears that will require the user to enter the reason why he changed the status and that information should be saved in the field "Reason".

    I know is an Afterupdate event and I'm using the InputBox function but not managing to get it working properly and for the field "Reason"

    Thanks in advance,

    Regards,
  • Aug 29, 2014, 04:26 AM
    ScottGem
    That's not the way I would do it. Have a control bound to the Reason field on your form. In the After Update event of the Status combo use this line of code:

    Me.Reason.SetFocus

    Assuming reason is the name of control bound to the Reason field.

    In the Lost Focus event of that control pit code like:

    If IsNull(Me.Reason) Then
    MsgBox "You must enter a reason!"
    Me.Reason.SetFocus
    End If

    So when the user changes the status, the Reason control gets the focus. If the user tries to exit the control without entering a reason, they will be told to do so and focus put back in the control. So they won't be able to exit the control without entering a reason.

  • All times are GMT -7. The time now is 02:33 AM.