• Cancel a combo choice (Access 2007)

    Author
    Topic
    #446285

    When a user selects a choice from a combo I want to give a choice to either accept the change or cancel the selection and return to the record with no change having been made.

    I can’t see for the life of me how to achieve it – stupid because I’ve done some VBA – can someone bail me out, thanks

    Viewing 2 reply threads
    Author
    Replies
    • #1084483

      You can use the escape key, but this will undo all changes you have made to the record.

    • #1084486

      You could use code in the Before Update event:

      Private Sub NameOfComboBox_BeforeUpdate(Cancel As Integer)
      If MsgBox(“Do you want to save changes?”, vbYesNo) = vbNo Then
      Cancel = True
      Me.NameOfComboBox.Undo
      End If
      End Sub

      where NameOfComboBox is the name of the combo box.

    • #1084541

      Thanks for the responses – whilst the escape key is a possibility, if the user recognizes an error, the method by Hans works fine and also allows for a customized message
      I was well off the mark with what I thought I could do, but you’ve given me a couple more nuggets, Hans – thanks again

    Viewing 2 reply threads
    Reply To: Cancel a combo choice (Access 2007)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: