Results 1 to 4 of 4
  • Thread Tools
  1. New Lounger
    Join Date
    Jun 2003
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cancel a combo choice (Access 2007)

    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

  2. Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,399
    Thanks
    0
    Thanked 13 Times in 13 Posts

    Re: Cancel a combo choice (Access 2007)

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

  3. Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Cancel a combo choice (Access 2007)

    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.

  4. New Lounger
    Join Date
    Jun 2003
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cancel a combo choice (Access 2007)

    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

Posting Permissions

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