+ Reply to Thread
Results 1 to 2 of 2

MsgBox in ComboBox Enter Event does not allow update

Hybrid View

  1. #1
    Richard
    Guest

    MsgBox in ComboBox Enter Event does not allow update

    I have a multipage (mpgLogs) on a form with three pages. I change which page
    to display based on the value of a combobox. I want to make sure the user
    wants to change the combobox value because I will delete control values on
    other pages of the multipage. So I show a msgbox with vbYesNo.

    If they click No, I want to keep the same combobox value and don't change
    the multipage. If they click Yes, clear multipage values and change the
    multipage to the page selected in the combobox.

    When the user clicks yes and then clicks a new value in the combobox the
    following events fire: 1) down button click 2) mouse down, 3) mouse up. No
    change event. The value of the combobox stays at the original value. Why
    don't the change, click events fire?

    Private Sub cbLogType_Enter()
    Dim stMsg, stTitle As String
    Dim iResponse, iStyle As Integer

    ' Define message.
    stMsg = "Are you sure you want to change the Log Type?" + vbCrLf
    stMsg = stMsg + "Clicking Yes will delete all previous values." + vbCrLf
    stMsg = stMsg + "Click Yes to change and No to keep the same Log Type?"
    ' Define buttons.
    iStyle = vbYesNo + vbQuestion
    ' Define title.
    stTitle = "Cancel Log Type Change?"

    ' Display message.
    iResponse = MsgBox(stMsg, iStyle, stTitle)

    If iResponse = vbNo Then
    ' User chose No so just change focus so that cbLogType does not change
    mpgLogs.SetFocus
    Else

    End If
    End Sub

  2. #2
    Richard
    Guest

    RE: MsgBox in ComboBox Enter Event does not allow update

    Sorry, I forgot to include the select case which chooses the page on the
    multipage in the Else. Which doesn't work either because the change event
    doesn't fire.

    "Richard" wrote:

    > I have a multipage (mpgLogs) on a form with three pages. I change which page
    > to display based on the value of a combobox. I want to make sure the user
    > wants to change the combobox value because I will delete control values on
    > other pages of the multipage. So I show a msgbox with vbYesNo.
    >
    > If they click No, I want to keep the same combobox value and don't change
    > the multipage. If they click Yes, clear multipage values and change the
    > multipage to the page selected in the combobox.
    >
    > When the user clicks yes and then clicks a new value in the combobox the
    > following events fire: 1) down button click 2) mouse down, 3) mouse up. No
    > change event. The value of the combobox stays at the original value. Why
    > don't the change, click events fire?
    >
    > Private Sub cbLogType_Enter()
    > Dim stMsg, stTitle As String
    > Dim iResponse, iStyle As Integer
    >
    > ' Define message.
    > stMsg = "Are you sure you want to change the Log Type?" + vbCrLf
    > stMsg = stMsg + "Clicking Yes will delete all previous values." + vbCrLf
    > stMsg = stMsg + "Click Yes to change and No to keep the same Log Type?"
    > ' Define buttons.
    > iStyle = vbYesNo + vbQuestion
    > ' Define title.
    > stTitle = "Cancel Log Type Change?"
    >
    > ' Display message.
    > iResponse = MsgBox(stMsg, iStyle, stTitle)
    >
    > If iResponse = vbNo Then
    > ' User chose No so just change focus so that cbLogType does not change
    > mpgLogs.SetFocus
    > Else
    >
    > End If
    > End Sub


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1